|
71 | 71 | (local (ref $private))
|
72 | 72 | )
|
73 | 73 | )
|
| 74 | + |
| 75 | +;; A function returning a string is taken by reference. We should update the |
| 76 | +;; ref.funcs for it, both in the table and in the code, and not error. |
| 77 | +(module |
| 78 | + ;; CHECK: (type $0 (array (mut i16))) |
| 79 | + |
| 80 | + ;; CHECK: (type $1 (func (param externref externref) (result i32))) |
| 81 | + |
| 82 | + ;; CHECK: (type $2 (func (result (ref extern)))) |
| 83 | + |
| 84 | + ;; CHECK: (type $3 (func (param (ref null $0) i32 i32) (result (ref extern)))) |
| 85 | + |
| 86 | + ;; CHECK: (type $4 (func (param i32) (result (ref extern)))) |
| 87 | + |
| 88 | + ;; CHECK: (type $5 (func (param externref externref) (result (ref extern)))) |
| 89 | + |
| 90 | + ;; CHECK: (type $6 (func (param externref (ref null $0) i32) (result i32))) |
| 91 | + |
| 92 | + ;; CHECK: (type $7 (func (param externref) (result i32))) |
| 93 | + |
| 94 | + ;; CHECK: (type $8 (func (param externref i32) (result i32))) |
| 95 | + |
| 96 | + ;; CHECK: (type $9 (func (param externref i32 i32) (result (ref extern)))) |
| 97 | + |
| 98 | + ;; CHECK: (import "wasm:js-string" "fromCharCodeArray" (func $fromCharCodeArray (type $3) (param (ref null $0) i32 i32) (result (ref extern)))) |
| 99 | + |
| 100 | + ;; CHECK: (import "wasm:js-string" "fromCodePoint" (func $fromCodePoint (type $4) (param i32) (result (ref extern)))) |
| 101 | + |
| 102 | + ;; CHECK: (import "wasm:js-string" "concat" (func $concat (type $5) (param externref externref) (result (ref extern)))) |
| 103 | + |
| 104 | + ;; CHECK: (import "wasm:js-string" "intoCharCodeArray" (func $intoCharCodeArray (type $6) (param externref (ref null $0) i32) (result i32))) |
| 105 | + |
| 106 | + ;; CHECK: (import "wasm:js-string" "equals" (func $equals (type $1) (param externref externref) (result i32))) |
| 107 | + |
| 108 | + ;; CHECK: (import "wasm:js-string" "compare" (func $compare (type $1) (param externref externref) (result i32))) |
| 109 | + |
| 110 | + ;; CHECK: (import "wasm:js-string" "length" (func $length (type $7) (param externref) (result i32))) |
| 111 | + |
| 112 | + ;; CHECK: (import "wasm:js-string" "charCodeAt" (func $charCodeAt (type $8) (param externref i32) (result i32))) |
| 113 | + |
| 114 | + ;; CHECK: (import "wasm:js-string" "substring" (func $substring (type $9) (param externref i32 i32) (result (ref extern)))) |
| 115 | + |
| 116 | + ;; CHECK: (table $table 31 31 funcref) |
| 117 | + (table $table 31 31 funcref) |
| 118 | + |
| 119 | + ;; CHECK: (elem $elem (i32.const 0) $func) |
| 120 | + (elem $elem (i32.const 0) $func) |
| 121 | + |
| 122 | + ;; CHECK: (func $func (type $2) (result (ref extern)) |
| 123 | + ;; CHECK-NEXT: (drop |
| 124 | + ;; CHECK-NEXT: (ref.func $func) |
| 125 | + ;; CHECK-NEXT: ) |
| 126 | + ;; CHECK-NEXT: (unreachable) |
| 127 | + ;; CHECK-NEXT: ) |
| 128 | + (func $func (result (ref string)) |
| 129 | + (drop |
| 130 | + (ref.func $func) |
| 131 | + ) |
| 132 | + (unreachable) |
| 133 | + ) |
| 134 | +) |
0 commit comments