mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-24 05:01:34 +00:00
Fix tests.
This commit is contained in:
parent
29613aef9c
commit
7ea00b975b
@ -82,7 +82,7 @@ fn wrong_import() {
|
||||
#[test]
|
||||
fn global_get_set() {
|
||||
let module = module()
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, true), InitExpr::new(vec![Opcode::I32Const(42)])))
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, true), InitExpr::new(vec![Opcode::I32Const(42), Opcode::End])))
|
||||
.function()
|
||||
.signature().return_type().i32().build()
|
||||
.body().with_opcodes(Opcodes::new(vec![
|
||||
|
@ -18,9 +18,9 @@ mod utils {
|
||||
.with_min(64)
|
||||
.build()
|
||||
.with_export(ExportEntry::new("table".into(), Internal::Table(0)))
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(0)])))
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(0), Opcode::End])))
|
||||
.with_export(ExportEntry::new("tableBase".into(), Internal::Global(0)))
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(0)])))
|
||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(0), Opcode::End])))
|
||||
.with_export(ExportEntry::new("memoryBase".into(), Internal::Global(1)))
|
||||
.build();
|
||||
program.add_module("env", env_module, None).unwrap();
|
||||
|
@ -67,7 +67,7 @@ impl Validator {
|
||||
func: &Func,
|
||||
body: &FuncBody,
|
||||
) -> Result<(), Error> {
|
||||
let (params, result_ty) = module.require_function(func.type_ref())?;
|
||||
let (params, result_ty) = module.require_function_type(func.type_ref())?;
|
||||
|
||||
// locals = (params + vars)
|
||||
let mut locals = params;
|
||||
|
@ -127,6 +127,11 @@ fn prepare_context(module: &Module) -> Result<ModuleContext, Error> {
|
||||
}
|
||||
|
||||
// Concatenate elements with defined in the module.
|
||||
if let Some(function_section) = module.function_section() {
|
||||
for func_entry in function_section.entries() {
|
||||
func_type_indexes.push(func_entry.type_ref());
|
||||
}
|
||||
}
|
||||
if let Some(table_section) = module.table_section() {
|
||||
for table_entry in table_section.entries() {
|
||||
table_entry.validate()?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user