Skip to content

Commit c8d58c7

Browse files
authored
Update test/harness/*_index.js for removing subtyping (WebAssembly#88)
This applies the changes made to 'script/js.ml' to the standalone test harnesses.
1 parent e56ef21 commit c8d58c7

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

test/harness/async_index.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,22 @@ const EXPECT_INVALID = false;
5252

5353
/* DATA **********************************************************************/
5454

55-
let hostrefs = {};
56-
let hostsym = Symbol("hostref");
57-
function hostref(s) {
58-
if (! (s in hostrefs)) hostrefs[s] = {[hostsym]: s};
59-
return hostrefs[s];
55+
let externrefs = {};
56+
let externsym = Symbol("externref");
57+
function externref(s) {
58+
if (! (s in externrefs)) externrefs[s] = {[externsym]: s};
59+
return externrefs[s];
6060
}
61-
function is_hostref(x) {
62-
return (x !== null && hostsym in x) ? 1 : 0;
61+
function is_externref(x) {
62+
return (x !== null && externsym in x) ? 1 : 0;
6363
}
6464
function is_funcref(x) {
6565
return typeof x === "function" ? 1 : 0;
6666
}
67-
function eq_ref(x, y) {
67+
function eq_externref(x, y) {
68+
return x === y ? 1 : 0;
69+
}
70+
function eq_funcref(x, y) {
6871
return x === y ? 1 : 0;
6972
}
7073

@@ -83,10 +86,11 @@ function reinitializeRegistry() {
8386

8487
chain = chain.then(_ => {
8588
let spectest = {
86-
hostref: hostref,
87-
is_hostref: is_hostref,
89+
externref: externref,
90+
is_externref: is_externref,
8891
is_funcref: is_funcref,
89-
eq_ref: eq_ref,
92+
eq_externref: eq_externref,
93+
eq_funcref: eq_funcref,
9094
print: console.log.bind(console),
9195
print_i32: console.log.bind(console),
9296
print_i32_f32: console.log.bind(console),

test/harness/sync_index.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,22 @@ const EXPECT_INVALID = false;
6666

6767
/* DATA **********************************************************************/
6868

69-
let hostrefs = {};
70-
let hostsym = Symbol("hostref");
71-
function hostref(s) {
72-
if (! (s in hostrefs)) hostrefs[s] = {[hostsym]: s};
73-
return hostrefs[s];
69+
let externrefs = {};
70+
let externsym = Symbol("externref");
71+
function externref(s) {
72+
if (! (s in externrefs)) externrefs[s] = {[externsym]: s};
73+
return externrefs[s];
7474
}
75-
function is_hostref(x) {
76-
return (x !== null && hostsym in x) ? 1 : 0;
75+
function is_externref(x) {
76+
return (x !== null && externsym in x) ? 1 : 0;
7777
}
7878
function is_funcref(x) {
7979
return typeof x === "function" ? 1 : 0;
8080
}
81-
function eq_ref(x, y) {
81+
function eq_externref(x, y) {
82+
return x === y ? 1 : 0;
83+
}
84+
function eq_funcref(x, y) {
8285
return x === y ? 1 : 0;
8386
}
8487

@@ -93,10 +96,11 @@ function reinitializeRegistry() {
9396
return;
9497

9598
let spectest = {
96-
hostref: hostref,
97-
is_hostref: is_hostref,
99+
externref: externref,
100+
is_externref: is_externref,
98101
is_funcref: is_funcref,
99-
eq_ref: eq_ref,
102+
eq_externref: eq_externref,
103+
eq_funcref: eq_funcref,
100104
print: console.log.bind(console),
101105
print_i32: console.log.bind(console),
102106
print_i32_f32: console.log.bind(console),

0 commit comments

Comments
 (0)