This commit is contained in:
Sergey Pepyakin
2017-12-05 17:10:40 +01:00
parent ba6018957a
commit 42142f6513
5 changed files with 6 additions and 16 deletions

View File

@ -1,5 +1,5 @@
use elements::{MemoryType, TableType, GlobalType, Type};
use elements::{Opcode, BlockType, ValueType, TableElementType};
use elements::{BlockType, ValueType};
use validation::Error;
pub struct ModuleContext {

View File

@ -1,9 +1,7 @@
use std::u32;
use std::sync::Arc;
use std::iter::repeat;
use std::collections::HashMap;
use elements::{Opcode, BlockType, ValueType, TableElementType, Func, FuncBody};
use elements::{FunctionType, Type};
use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX};
use validation::context::ModuleContext;
@ -709,10 +707,6 @@ impl<'a> FunctionValidationContext<'a> {
.ok_or(Error(format!("Trying to access local with index {} when there are only {} locals", idx, self.locals.len())))
}
fn function_labels(self) -> HashMap<usize, usize> {
self.labels
}
fn check_stack_access(&self) -> Result<(), Error> {
let value_stack_min = self.frame_stack.top().expect("at least 1 topmost block").value_stack_len;
if self.value_stack.len() > value_stack_min {

View File

@ -1,9 +1,8 @@
#![allow(unused, missing_docs)]
#![allow(missing_docs)]
use std::fmt;
use std::iter::repeat;
use elements::{BlockType, External, FunctionType, GlobalEntry, GlobalType, Internal, MemoryType,
Module, Opcode, ResizableLimits, TableType, Type, ValueType, InitExpr};
use elements::{BlockType, External, GlobalEntry, GlobalType, Internal, MemoryType,
Module, Opcode, ResizableLimits, TableType, ValueType, InitExpr};
use common::stack;
use self::context::ModuleContext;
use self::func::Validator;

View File

@ -1,6 +1,4 @@
use elements::{MemoryType, TableType, GlobalType, Type};
use elements::{Opcode, BlockType, ValueType, TableElementType};
use validation::Error;
pub struct ValidatedModule {
pub memories: Vec<MemoryType>,

View File

@ -1,8 +1,7 @@
use super::validate_module;
use builder::module;
use elements::{BlockType, ExportEntry, External, FunctionType, GlobalEntry, GlobalType,
ImportEntry, InitExpr, Internal, MemoryType, Opcode, Opcodes, TableType,
ValueType};
use elements::{External, GlobalEntry, GlobalType, ImportEntry, InitExpr, MemoryType,
Opcode, Opcodes, TableType, ValueType};
#[test]
fn empty_is_valid() {