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::{MemoryType, TableType, GlobalType, Type};
use elements::{Opcode, BlockType, ValueType, TableElementType}; use elements::{BlockType, ValueType};
use validation::Error; use validation::Error;
pub struct ModuleContext { pub struct ModuleContext {

View File

@ -1,9 +1,7 @@
use std::u32; use std::u32;
use std::sync::Arc;
use std::iter::repeat; use std::iter::repeat;
use std::collections::HashMap; use std::collections::HashMap;
use elements::{Opcode, BlockType, ValueType, TableElementType, Func, FuncBody}; use elements::{Opcode, BlockType, ValueType, TableElementType, Func, FuncBody};
use elements::{FunctionType, Type};
use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX}; use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX};
use validation::context::ModuleContext; 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()))) .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> { fn check_stack_access(&self) -> Result<(), Error> {
let value_stack_min = self.frame_stack.top().expect("at least 1 topmost block").value_stack_len; 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 { 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::fmt;
use std::iter::repeat; use elements::{BlockType, External, GlobalEntry, GlobalType, Internal, MemoryType,
use elements::{BlockType, External, FunctionType, GlobalEntry, GlobalType, Internal, MemoryType, Module, Opcode, ResizableLimits, TableType, ValueType, InitExpr};
Module, Opcode, ResizableLimits, TableType, Type, ValueType, InitExpr};
use common::stack; use common::stack;
use self::context::ModuleContext; use self::context::ModuleContext;
use self::func::Validator; use self::func::Validator;

View File

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

View File

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