summaryrefslogtreecommitdiff
path: root/test/passes/extract-function_pass-arg=extract-function@foo.wast
blob: ab1d8b2693b6b31e4509d560b99ab4f7ff685c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(module
  (func $foo
    (call $bar)
  )
  (func $bar
    (call $foo)
  )
  (func $other
    (drop (i32.const 1))
  )
)
(module
  ;; Use another function in the table, but the table is not used in the
  ;; extracted function
  (table $t 10 funcref)
  (elem $0 (table $t) (i32.const 0) func $other)
  (func $foo
  )
  (func $other
    (drop (i32.const 1))
  )
)
(module
  ;; Use another function in the table, and the table *is* used. As a result,
  ;; the table and its elements will remain. The called function, $other, will
  ;; remain as an import that is placed in the table.
  (type $none (func))
  (table $t 10 funcref)
  (elem $0 (table $t) (i32.const 0) func $other)
  (func $foo
   (call_indirect (type $none) (i32.const 10))
  )
  (func $other
    (drop (i32.const 1))
  )
)