summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/function-references/ref.wast.js
blob: 5d2fce23141bb1029f7d44b6d7af11318d23c8c2 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* Copyright 2021 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// ./test/core/ref.wast

// ./test/core/ref.wast:3
let $0 = instantiate(`(module
  (type $$t (func))

  (func
    (param
      funcref
      externref
      (ref func)
      (ref extern)
      (ref 0)
      (ref $$t)
      (ref 0)
      (ref $$t)
      (ref null func)
      (ref null extern)
      (ref null 0)
      (ref null $$t)
    )
  )
)`);

// ./test/core/ref.wast:27
assert_invalid(
  () => instantiate(`(module (type $$type-func-param-invalid (func (param (ref 1)))))`),
  `unknown type`,
);

// ./test/core/ref.wast:31
assert_invalid(
  () => instantiate(`(module (type $$type-func-result-invalid (func (result (ref 1)))))`),
  `unknown type`,
);

// ./test/core/ref.wast:36
assert_invalid(
  () => instantiate(`(module (global $$global-invalid (ref null 1) (ref.null 1)))`),
  `unknown type`,
);

// ./test/core/ref.wast:41
assert_invalid(
  () => instantiate(`(module (table $$table-invalid 10 (ref null 1)))`),
  `unknown type`,
);

// ./test/core/ref.wast:46
assert_invalid(
  () => instantiate(`(module (elem $$elem-invalid (ref 1)))`),
  `unknown type`,
);

// ./test/core/ref.wast:51
assert_invalid(
  () => instantiate(`(module (func $$func-param-invalid (param (ref 1))))`),
  `unknown type`,
);

// ./test/core/ref.wast:55
assert_invalid(
  () => instantiate(`(module (func $$func-result-invalid (result (ref 1))))`),
  `unknown type`,
);

// ./test/core/ref.wast:59
assert_invalid(
  () => instantiate(`(module (func $$func-local-invalid (local (ref null 1))))`),
  `unknown type`,
);

// ./test/core/ref.wast:64
assert_invalid(
  () => instantiate(`(module (func $$block-result-invalid (drop (block (result (ref 1)) (unreachable)))))`),
  `unknown type`,
);

// ./test/core/ref.wast:68
assert_invalid(
  () => instantiate(`(module (func $$loop-result-invalid (drop (loop (result (ref 1)) (unreachable)))))`),
  `unknown type`,
);

// ./test/core/ref.wast:72
assert_invalid(
  () => instantiate(`(module (func $$if-invalid (drop (if (result (ref 1)) (then) (else)))))`),
  `unknown type`,
);

// ./test/core/ref.wast:77
assert_invalid(
  () => instantiate(`(module (func $$select-result-invalid (drop (select (result (ref 1)) (unreachable)))))`),
  `unknown type`,
);