module level validation

This commit is contained in:
Svyatoslav Nikolsky
2017-06-08 10:49:32 +03:00
parent 6c31fd61c2
commit 0cb48d7730
6 changed files with 145 additions and 24 deletions

View File

@ -3,6 +3,7 @@ use std::sync::Arc;
use parking_lot::RwLock;
use elements::TableType;
use interpreter::Error;
use interpreter::module::check_limits;
use interpreter::variable::{VariableInstance, VariableType};
use interpreter::value::RuntimeValue;
@ -17,6 +18,8 @@ pub struct TableInstance {
impl TableInstance {
/// New instance of the table
pub fn new(variable_type: VariableType, table_type: &TableType) -> Result<Arc<Self>, Error> {
check_limits(table_type.limits())?;
Ok(Arc::new(TableInstance {
variable_type: variable_type,
buffer: RwLock::new(