Reorganize

This commit is contained in:
Sergey Pepyakin
2017-12-01 09:07:56 +03:00
parent 28199fdac8
commit 12a1bcfe04

View File

@ -1,15 +1,11 @@
#![allow(unused, missing_docs)]
use elements::{Module, ResizableLimits, MemoryType, TableType};
pub struct Error(pub String);
pub fn validate_module(module: &Module) -> Result<(), Error> {
if let Some(mem_section) = module.memory_section() {
mem_section
.entries()
.iter()
.map(MemoryType::validate)
.collect::<Result<_, _>>()?
}
// TODO: Functions
if let Some(table_section) = module.table_section() {
table_section
@ -19,6 +15,14 @@ pub fn validate_module(module: &Module) -> Result<(), Error> {
.collect::<Result<_, _>>()?
}
if let Some(mem_section) = module.memory_section() {
mem_section
.entries()
.iter()
.map(MemoryType::validate)
.collect::<Result<_, _>>()?
}
Ok(())
}