Skip to content

Commit 8ec8b4b

Browse files
author
Guy Bedford
committed
fixups, linking note
1 parent fd68140 commit 8ec8b4b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

document/js-api/index.bs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,10 +1507,10 @@ WebAssembly Module Records have the following methods:
15071507
1. If |v| [=implements=] {{Global}},
15081508
1. Let |globaladdr| be |v|.\[[Global]].
15091509
1. Let |targetmut| <var ignore>valuetype</var> be [=global_type=](|store|, |globaladdr|).
1510-
1. If |mut| is [=const=] and |targetmut| is [=var=], throw a {{TypeError}}.
1510+
1. If |mut| is [=const=] and |targetmut| is [=var=], throw a {{LinkError}} exception.
15111511
1. Otherwise,
15121512
1. If |valtype| is [=v128=], throw a {{LinkError}} exception.
1513-
1. If |mut| is [=var=], throw a {{TypeError}}.
1513+
1. If |mut| is [=var=], throw a {{LinkError}} exception.
15141514
1. Let |value| be [=?=] [=ToWebAssemblyValue=](|v|, |valtype|).
15151515
1. Let (|store|, |globaladdr|) be [=global_alloc=](|store|, |mut| |valtype|, |value|).
15161516
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
@@ -1543,6 +1543,11 @@ WebAssembly Module Records have the following methods:
15431543
1. Otherwise,
15441544
1. Perform ! |record|.\[[Environment]].InitializeBinding(|name|, ! Get(|instance|.\[[Exports]], |name|)).
15451545

1546+
Note: The linking semantics here for Wasm to Wasm modules are identical to the WebAssembly JS API semantics as if passing the
1547+
the exports object as the imports object in instantiation. When linking Wasm module imports to JS module exports, the JS API semantics
1548+
are exactly followed as well. It is only in the case of importing Wasm from JS that WebAssembly.Global unwrapping is observable on the
1549+
WebAssembly Module Record Environment Record.
1550+
15461551
</div>
15471552

15481553
<h3 id="hostgetmodulesourcemodulerecord">HostGetModuleSourceModuleRecord ( |specifier| )</h3>

0 commit comments

Comments
 (0)