Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 8f14916

Browse files
authored
[js-api] Update the 'read the imports' process (#467)
2 parents c05877a + 0796934 commit 8f14916

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

document/js-api/index.bs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,21 +361,19 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
361361
1. Let |externfunc| be the [=external value=] [=external value|func=] |funcaddr|.
362362
1. [=list/Append=] |externfunc| to |imports|.
363363
1. If |externtype| is of the form [=global=] <var ignore>mut</var> |valtype|,
364-
1. If [=Type=](|v|) is Number or BigInt,
365-
1. If |valtype| is [=i64=] and [=Type=](|v|) is Number,
364+
1. If |v| [=implements=] {{Global}},
365+
1. Let |globaladdr| be |v|.\[[Global]].
366+
1. Otherwise,
367+
1. If |valtype| is [=i64=] and [=Type=](|v|) is not BigInt,
366368
1. Throw a {{LinkError}} exception.
367-
1. If |valtype| is not [=i64=] and [=Type=](|v|) is BigInt,
369+
1. If |valtype| is one of [=i32=], [=f32=] or [=f64=] and [=Type=](|v|) is not Number,
368370
1. Throw a {{LinkError}} exception.
369371
1. If |valtype| is [=v128=],
370372
1. Throw a {{LinkError}} exception.
371373
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valtype|).
372374
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
373375
1. Let (|store|, |globaladdr|) be [=global_alloc=](|store|, [=const=] |valtype|, |value|).
374376
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
375-
1. Otherwise, if |v| [=implements=] {{Global}},
376-
1. Let |globaladdr| be |v|.\[[Global]].
377-
1. Otherwise,
378-
1. Throw a {{LinkError}} exception.
379377
1. Let |externglobal| be [=external value|global=] |globaladdr|.
380378
1. [=list/Append=] |externglobal| to |imports|.
381379
1. If |externtype| is of the form [=mem=] <var ignore>memtype</var>,

0 commit comments

Comments
 (0)