Skip to content

Commit 7876227

Browse files
authored
Refactor parsing to use a byte sequence, bikeshed fixes (#86)
1 parent 9bd2997 commit 7876227

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

document/js-api/index.bs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ urlPrefix: https://tc39.es/proposal-resizablearraybuffer/; spec: ResizableArrayB
180180

181181
<pre class='link-defaults'>
182182
spec:infra; type:dfn; text:list
183+
spec:infra; type:dfn; text:byte sequence
183184
spec:ecma-262; type:exception; for:ECMAScript; text:Error
184185
spec:ecmascript; type:exception; for:ECMAScript; text:TypeError
185186
spec:ecmascript; type:exception; for:ECMAScript; text:RangeError
@@ -524,8 +525,8 @@ interface Module {
524525
};
525526
</pre>
526527

527-
Per ECMA-262 requirements for Source Phase Imports ([[!SOURCEPHASEIMPORTS]]) integration, the interface prototype object for {{Module}} must have as its \[[Prototype]] set to [=%AbstractModuleSource%.prototype=], as if created by [$OrdinaryObjectCreate$]([=%AbstractModuleSource%.prototype=]), instead of [=%ObjectPrototype%=].
528-
In addition, the interface object for {{Module}} should have as its \[[Prototype]] set to [=%AbstractModuleSource%=], as if created by [$OrdinaryObjectCreate$]([=%AbstractModuleSource%=]), instead of [=%ObjectPrototype%=].
528+
Per ECMA-262 requirements for Source Phase Imports ([[!SOURCEPHASEIMPORTS]]) integration, the interface prototype object for {{Module}} must have as its \[[Prototype]] set to [=%AbstractModuleSource%.prototype=], as if created by [$OrdinaryObjectCreate$]([=%AbstractModuleSource%.prototype=]).
529+
In addition, the interface object for {{Module}} should have as its \[[Prototype]] set to [=%AbstractModuleSource%=], as if created by [$OrdinaryObjectCreate$]([=%AbstractModuleSource%=]).
529530

530531
<div algorithm>
531532
The <dfn>string value of the extern type</dfn> |type| is
@@ -1337,7 +1338,7 @@ Note: It is possible to implement the Wasm-ESM integration in two stages. In the
13371338
* \[[WebAssemblyModule]] : a WebAssembly {{Module}} object
13381339

13391340
<div algorithm>
1340-
To <dfn export>parse a WebAssembly module</dfn> given a an {{ArrayBuffer}} |bytes|, a Realm |realm| and object |hostDefined|, perform the following steps.
1341+
To <dfn export>parse a WebAssembly module</dfn> given a <a>byte sequence</a> |bytes|, a Realm |realm| and object |hostDefined|, perform the following steps.
13411342

13421343
1. Let |stableBytes| be a [=get a copy of the buffer source|copy of the bytes held by the buffer=] |bytes|.
13431344
1. [=Compile a WebAssembly module|Compile the WebAssembly module=] |stableBytes| and store the result as |module|.
@@ -1425,13 +1426,14 @@ WebAssembly Module Records have the following methods:
14251426
1. Let |importedModule| be [$GetImportedModule$](|record|, |importedModuleName|).
14261427
1. Let |value| be ? |importedModule|.\[[Environment]].GetBindingValue(|name|, true).
14271428
1. Set |imports|[|importedModuleName|][|name|] to |value|.
1428-
1. Let |importsObject| be ! [$OrdinaryObjectCreate$](null).
1429+
1. Let |importObject| be ! [$OrdinaryObjectCreate$](null).
14291430
1. For each |key| → |value| of |imports|,
14301431
1. Let |moduleImportsObject| be ! [$OrdinaryObjectCreate$](null).
14311432
1. For each |importedName| → |importedValue| of |value|,
14321433
1. Perform ! [$CreateDataPropertyOrThrow$](|moduleImportsObject|, |importedName|, |importedValue|).
1433-
1. Perform ! [$CreateDataPropertyOrThrow$](|importsObject|, |key|, |moduleImportsObject|).
1434-
1. Let |instance| be the result of [=Instantiate a WebAssembly module|instantiating the WebAssembly module=] |module| with imports |importsObject|.
1434+
1. Perform ! [$CreateDataPropertyOrThrow$](|importObject|, |key|, |moduleImportsObject|).
1435+
1. [=Read the imports=] of |module| with imports |importObject|, and let |imports| be the result.
1436+
1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result.
14351437
1. For each |name| in the [=export name list=] of |record|,
14361438
1. Perform ! |record|.\[[Environment]].InitializeBinding(|name|, ! Get(|instance|.\[[Exports]], |name|)).
14371439

0 commit comments

Comments
 (0)