Skip to content

Commit f1c3a98

Browse files
authored
Merge pull request #94 from WebAssembly/module-source-slot
Use AbstractModuleSource [[ModuleSource]] slot
2 parents 493b1bf + 20a3579 commit f1c3a98

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

document/js-api/index.bs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Date: now
2020
{
2121
"SOURCEPHASEIMPORTS": {
2222
"href": "https://tc39.es/proposal-source-phase-imports/",
23-
"title": "Top-Level Await"
23+
"title": "Source Phase Imports"
2424
},
2525
"WEBASSEMBLY": {
2626
"href": "https://webassembly.github.io/spec/core/",
@@ -77,10 +77,9 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
7777
text: Array; url: sec-array-exotic-objects
7878
text: BigInt; url: sec-ecmascript-language-types-bigint-type
7979
text: CreateArrayFromList; url: sec-createarrayfromlist
80+
text: Cyclic Module Record; url: cyclic-module-record
8081
text: GetMethod; url: sec-getmethod
8182
text: ToBigInt64; url: #sec-tobigint64
82-
text: BigInt; url: #sec-ecmascript-language-types-bigint-type
83-
text: Cyclic Module Record; url: cyclic-module-record
8483
type: abstract-op
8584
text: CreateDataPropertyOrThrow; url: sec-createdatapropertyorthrow
8685
text: CreateMethodProperty; url: sec-createmethodproperty
@@ -1377,8 +1376,7 @@ WebAssembly modules can be used in a module graph with ECMAScript modules and So
13771376

13781377
Note: While this specification is not yet merged into the main Wasm specification, since it defines both a Source Phase Imports integration and an evaluation/instance phase integration, implementations may choose to implement only the Source Phase Imports as its own smaller proposal without implementing the full evaluation/instance phase import support. In this case, the `ResolveExport` abstract operation should be implemented as returning null, and the `InitializeEnvironment` and `ExecuteModule` abstract operations implemented as unconditionally throwing a `SyntaxError` exception. This note will be removed when this proposal is upstreamed.
13791378

1380-
<dfn export>WebAssembly Module Record</dfn>s are a subclass of [=Cyclic Module Record=] which contain WebAssembly code. WebAssembly Module Records have one additional internal slot:
1381-
* \[[WebAssemblyModule]] : a WebAssembly {{Module}} object
1379+
<dfn export>WebAssembly Module Record</dfn>s are a subclass of [=Cyclic Module Record=] which contain WebAssembly code.
13821380

13831381
<div algorithm>
13841382
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.
@@ -1393,8 +1391,9 @@ To <dfn export>parse a WebAssembly module</dfn> given a <a>byte sequence</a> |by
13931391
1. Return {
13941392
<!-- Abstract Module Records -->
13951393
\[[Realm]]: |realm|,
1396-
\[[Environment]]: undefined,
1397-
\[[Namespace]]: undefined,
1394+
\[[Environment]]: ~empty~,
1395+
\[[Namespace]]: ~empty~,
1396+
\[[ModuleSource]]: |module|,
13981397
\[[HostDefined]]: |hostDefined|,
13991398
<!-- Cyclic Module Records -->
14001399
\[[Status]]: "new",
@@ -1409,8 +1408,6 @@ To <dfn export>parse a WebAssembly module</dfn> given a <a>byte sequence</a> |by
14091408
\[[TopLevelCapability]]: ~empty~
14101409
\[[AsyncParentModules]]: &laquo; &raquo;,
14111410
\[[PendingAsyncDependencies]]: ~empty~,
1412-
<!-- WebAssembly Module Records -->
1413-
\[[WebAssemblyModule]]: |module|
14141411
}.
14151412

14161413
Note: From HTML, it's not observable when [=parse a WebAssembly module=] begins, so any work perfomed in compilation may be performed off-thread.
@@ -1419,7 +1416,7 @@ Note: From HTML, it's not observable when [=parse a WebAssembly module=] begins,
14191416
<div algorithm>
14201417
The <dfn>export name list</dfn> of a WebAssembly Module Record |record| is defined by the following algorithm:
14211418

1422-
1. Let |module| be |record|'s \[[WebAssemblyModule]] internal slot.
1419+
1. Let |module| be |record|'s \[[ModuleSource]] internal slot.
14231420
1. Let |exports| be an empty [=list=].
14241421
1. For each (|name|, <var ignore>type</var>) in [=module_exports=](|module|.\[[Module]])
14251422
1. [=list/Append=] |name| to the end of |exports|.
@@ -1462,7 +1459,7 @@ WebAssembly Module Records have the following methods:
14621459
<h3 id="module-execution">ExecuteModule ( [ |promiseCapability| ] ) Concrete Method</h3>
14631460
1. Assert: |promiseCapability| was not provided.
14641461
1. Let |record| be this WebAssembly Module Record.
1465-
1. Let |module| be |record|.\[[WebAssemblyModule]].
1462+
1. Let |module| be |record|.\[[ModuleSource]].
14661463
1. Let |imports| be a new, empty [=map=].
14671464
1. For each (|importedModuleName|, |name|, <var ignore>type</var>) in [=module_imports=](|module|.\[[Module]]),
14681465
1. If |imports|[|importedModuleName|] does not exist, set |imports|[|importedModuleName|] to a new, empty [=map=].
@@ -1484,15 +1481,6 @@ WebAssembly Module Records have the following methods:
14841481

14851482
</div>
14861483

1487-
<div algorithm=GetModuleSource>
1488-
1489-
<h3 id="get-module-source">GetModuleSource ( ) Concrete Method</h3>
1490-
1. Let |record| be this WebAssembly Module Record.
1491-
1. Let |module| be |record|.\[[WebAssemblyModule]].
1492-
1. Return |module|.
1493-
1494-
</div>
1495-
14961484
<h3 id="hostgetmodulesourcename">HostGetModuleSourceName</h3>
14971485

14981486
Hosts should implement [$HostGetModuleSourceName$] such that whenever a WebAssembly {{Module}} object is provided with a \[[Module]] internal slot, the string "<code data-x="">WebAssembly.Module</code>" is always returned.

0 commit comments

Comments
 (0)