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]
|
#[test]
|
||||||
fn global_get_set() {
|
fn global_get_set() {
|
||||||
let module = module()
|
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()
|
.function()
|
||||||
.signature().return_type().i32().build()
|
.signature().return_type().i32().build()
|
||||||
.body().with_opcodes(Opcodes::new(vec![
|
.body().with_opcodes(Opcodes::new(vec![
|
||||||
|
@ -18,9 +18,9 @@ mod utils {
|
|||||||
.with_min(64)
|
.with_min(64)
|
||||||
.build()
|
.build()
|
||||||
.with_export(ExportEntry::new("table".into(), Internal::Table(0)))
|
.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_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)))
|
.with_export(ExportEntry::new("memoryBase".into(), Internal::Global(1)))
|
||||||
.build();
|
.build();
|
||||||
program.add_module("env", env_module, None).unwrap();
|
program.add_module("env", env_module, None).unwrap();
|
||||||
|
@ -67,7 +67,7 @@ impl Validator {
|
|||||||
func: &Func,
|
func: &Func,
|
||||||
body: &FuncBody,
|
body: &FuncBody,
|
||||||
) -> Result<(), Error> {
|
) -> 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)
|
// locals = (params + vars)
|
||||||
let mut locals = params;
|
let mut locals = params;
|
||||||
|
@ -127,6 +127,11 @@ fn prepare_context(module: &Module) -> Result<ModuleContext, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate elements with defined in the module.
|
// 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() {
|
if let Some(table_section) = module.table_section() {
|
||||||
for table_entry in table_section.entries() {
|
for table_entry in table_section.entries() {
|
||||||
table_entry.validate()?;
|
table_entry.validate()?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user