From 876184d781b42f9cfd5124139e43b548e2521f03 Mon Sep 17 00:00:00 2001 From: yfzhe Date: Sat, 7 Dec 2024 19:37:11 +0800 Subject: [PATCH] examples: fix wat code There must be `then` and `else` literals in the folded if block. --- .../examples/03-fibonacci-tail/main.wat | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/webassembly-playground/examples/03-fibonacci-tail/main.wat b/packages/webassembly-playground/examples/03-fibonacci-tail/main.wat index 74ef144..5a19fc9 100644 --- a/packages/webassembly-playground/examples/03-fibonacci-tail/main.wat +++ b/packages/webassembly-playground/examples/03-fibonacci-tail/main.wat @@ -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)