Skip to content

Commit

Permalink
examples: fix wat code
Browse files Browse the repository at this point in the history
There must be `then` and `else` literals in the folded if block.
  • Loading branch information
yfzhe committed Dec 7, 2024
1 parent 6d5dfaf commit 876184d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
(func $fib_tail_helper (param i32 i64 i64) (result i64)
(if (result i64)
(i32.eqz (local.get 0))
(local.get 1)
(return_call $fib_tail_helper
(i32.sub (local.get 0) (i32.const 1))
(local.get 2)
(i64.add (local.get 1) (local.get 2)))))
(then (local.get 1))
(else
(return_call $fib_tail_helper
(i32.sub (local.get 0) (i32.const 1))
(local.get 2)
(i64.add (local.get 1) (local.get 2))))))

(func $fib_tail (export "fib") (param i32) (result i64)
(call $fib_tail_helper (local.get 0)
Expand Down

0 comments on commit 876184d

Please sign in to comment.