mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-21 20:51:32 +00:00
Get control flow working (fingers crossed)
This commit is contained in:
@ -30,21 +30,26 @@ impl Compiler for LLVMCompiler {
|
||||
#[test]
|
||||
fn test_read_module() {
|
||||
use wabt::wat2wasm;
|
||||
let WAT: &'static str = r#"
|
||||
let wat = r#"
|
||||
(module
|
||||
(type $t0 (func (param i32) (result i32)))
|
||||
(import "env" "memory" (memory 1 1))
|
||||
(import "env" "table" (table 10 anyfunc))
|
||||
(import "env" "global" (global i32))
|
||||
(import "env" "print_i32" (func $print_i32 (type $t0)))
|
||||
(func $identity (type $t0) (param $p0 i32) (result i32)
|
||||
get_local $p0)
|
||||
(func $print_num (export "print_num") (type $t0) (param $p0 i32) (result i32)
|
||||
get_global 0
|
||||
call $identity
|
||||
call $print_i32))
|
||||
(type $t1 (func (result i32)))
|
||||
(func $foo (type $t0) (param i32) (result i32)
|
||||
get_local 0
|
||||
(if
|
||||
(then
|
||||
i32.const 42
|
||||
set_local 0
|
||||
)
|
||||
(else
|
||||
i32.const 24
|
||||
set_local 0
|
||||
)
|
||||
)
|
||||
get_local 0
|
||||
))
|
||||
"#;
|
||||
let wasm = wat2wasm(WAT).unwrap();
|
||||
let wasm = wat2wasm(wat).unwrap();
|
||||
|
||||
let (info, code_reader) = read_info::read_module(&wasm).unwrap();
|
||||
|
||||
|
Reference in New Issue
Block a user