* add WebAssembly lexer * avoid test failure by using the default function instead of an empty regex * address small issues * fix WebAssembly string escapes * change WebAssembly multiline comment parsing * update copyright year * set versionadded to 2.9 * change WebAssembly tests to use the new test system * change WebAssembly unit test to use snippets
35 lines
No EOL
916 B
Text
35 lines
No EOL
916 B
Text
(module
|
|
(func $fib (param $n i32) (result i32)
|
|
(local $a i32)
|
|
(local $b i32)
|
|
(local $result i32)
|
|
(if
|
|
(i32.eqz (local.get $n))
|
|
(then
|
|
(return (i32.const 1))
|
|
)
|
|
)
|
|
(local.set $b (i32.const 1))
|
|
(; nested (; comment ;) ;)
|
|
loop
|
|
(local.set $result (i32.add (local.get $a) (local.get $b)))
|
|
(local.set $a (local.get $b))
|
|
(local.set $b (local.get $result))
|
|
|
|
;; decrement $n
|
|
(local.tee $n (i32.sub (local.get $n) (i32.const 1)))
|
|
|
|
(; test if $n > 0 ;)
|
|
(i32.gt_u (i32.const 0))
|
|
|
|
;; if so, jump to the beginning of the loop
|
|
br_if 0
|
|
end
|
|
local.get $result
|
|
)
|
|
(func $test_memory_store_args
|
|
i32.const 1
|
|
f64.store align=8 offset=16
|
|
)
|
|
(export "fib" (func $fib))
|
|
) |