File tree 1 file changed +18
-6
lines changed 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 19
19
)
20
20
21
21
(func (export " call2" ) (param $i i32 ) (param $j i32 ) (param $k i32 ) (result i32 )
22
- (call $mk-adder (local.get $k ))
23
- (let (result i32 ) (local $f (ref $unop )) ;; binds $f to top of stack
24
- (i32.mul
25
- (call_ref (local.get $i ) (local.get $f ))
26
- (call_ref (local.get $j ) (local.get $f ))
27
- )
22
+ (local $f (ref null $unop ))
23
+ (local.set $f (call $mk-adder (local.get $k )))
24
+
25
+ (i32.mul
26
+ (call_ref (local.get $i ) (local.get $f ))
27
+ (call_ref (local.get $j ) (local.get $f ))
28
+ )
29
+ )
30
+
31
+ (func (export " call3" ) (param $i i32 ) (param $j i32 ) (param $k i32 ) (result i32 )
32
+
33
+ (i32.mul
34
+ (call_ref (local.get $i ) (call $mk-adder (local.get $k )))
35
+ (call_ref (local.get $j ) (call $mk-adder (local.get $k )))
28
36
)
29
37
)
30
38
50
58
(assert_return (invoke " call2" (i32.const 2 ) (i32.const 5 ) (i32.const 1 )) (i32.const 18 ))
51
59
(assert_return (invoke " call2" (i32.const 2 ) (i32.const 5 ) (i32.const 7 )) (i32.const 108 ))
52
60
61
+ (assert_return (invoke " call3" (i32.const 4 ) (i32.const 9 ) (i32.const 1 )) (i32.const 50 ))
62
+ (assert_return (invoke " call3" (i32.const 4 ) (i32.const 7 ) (i32.const 2 )) (i32.const 54 ))
63
+ (assert_return (invoke " call3" (i32.const 4 ) (i32.const 5 ) (i32.const 3 )) (i32.const 56 ))
64
+
53
65
(assert_trap (invoke " null" ) " null function" )
54
66
55
67
(module
You can’t perform that action at this time.
0 commit comments