Skip to content

Commit 5021df4

Browse files
committed
Remove synthetic module records
1 parent 183a2a0 commit 5021df4

File tree

1 file changed

+0
-168
lines changed

1 file changed

+0
-168
lines changed

index.bs

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,6 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
236236
text: running execution context; url: running-execution-context
237237
</pre>
238238

239-
<pre class=biblio>
240-
{
241-
"JSSTDLIB": {
242-
"href": "https://github.com/tc39/proposal-javascript-standard-library/",
243-
"title": "Standard Library Proposal"
244-
}
245-
}
246-
</pre>
247-
248239
<style>
249240
pre.set {
250241
font-size: 80%;
@@ -14248,165 +14239,6 @@ the exact steps to take if <dfn>an exception was thrown</dfn>, or by explicitly
1424814239
</div>
1424914240

1425014241

14251-
<h3 id="synthetic-module-records">Synthetic module records</h3>
14252-
14253-
A <dfn export>Synthetic Module Record</dfn> is used to represent information about a module that is
14254-
defined by specifications.
14255-
The set of exported names is static, and determined at creation time (as an argument to
14256-
[$CreateSyntheticModule$]), while the set of exported values can be changed over time using
14257-
[$SetSyntheticModuleExport$].
14258-
It has no imports or dependencies.
14259-
14260-
Note: A [=Synthetic Module Record=] could be used for defining a variety of module types: for
14261-
example, built-in modules, or JSON modules, or CSS modules.
14262-
14263-
Note: [=Synthetic Module Records=] are being developed in concert with the authors of the
14264-
<cite>JavaScript Standard Library</cite> proposal, and might eventually move to the ECMAScript
14265-
specification. [[JSSTDLIB]] [[ECMA-262]].
14266-
14267-
In addition to the [=Module Record Fields=], Synthetic Module Records have the additional fields
14268-
listed below.
14269-
Each of these fields is initially set in [$CreateSyntheticModule$].
14270-
14271-
<table id="table-synthetic-module-record-fields" class="data">
14272-
<caption>Additional Fields of Synthetic Module Records</caption>
14273-
<thead>
14274-
<tr>
14275-
<th>Field Name
14276-
<th>Value Type
14277-
<th>Meaning
14278-
<tbody>
14279-
<tr>
14280-
<td>\[[ExportNames]]
14281-
<td>List of String
14282-
<td>A List of all names that are exported.
14283-
<tr>
14284-
<td>\[[EvaluationSteps]]
14285-
<td>An abstract operation
14286-
<td>An abstract operation that will be performed upon evaluation of the module, taking the
14287-
[=Synthetic Module Record=] as its sole argument.
14288-
These will usually set up the exported values, by using [$SetSyntheticModuleExport$].
14289-
They must not modify \[[ExportNames]].
14290-
They may return an abrupt completion.
14291-
</table>
14292-
14293-
<h4 id="createsyntheticmodule">CreateSyntheticModule</h4>
14294-
14295-
<div algorithm>
14296-
The abstract operation <dfn abstract-op>CreateSyntheticModule</dfn>(|exportNames|, |evaluationSteps|, |realm|, |hostDefined|) creates a [=Synthetic Module Record=] based upon
14297-
the given exported names and evaluation steps.
14298-
It performs the following steps:
14299-
14300-
1. Return [=Synthetic Module Record=] {
14301-
\[[Realm]]: |realm|,
14302-
\[[Environment]]: <emu-val>undefined</emu-val>,
14303-
\[[Namespace]]: <emu-val>undefined</emu-val>,
14304-
\[[HostDefined]]: |hostDefined|,
14305-
\[[ExportNames]]: |exportNames|,
14306-
\[[EvaluationSteps]]: |evaluationSteps|
14307-
}.
14308-
</div>
14309-
14310-
Note: we could set up \[[Environment]] either here or in [$Synthetic Module Record/Link$]().
14311-
It is done in [$Synthetic Module Record/Link$]() for symmetry with [=Source Text Module Records=],
14312-
but there is no observable difference.
14313-
14314-
<h4 id="setsyntheticmoduleexport">SetSyntheticModuleExport</h4>
14315-
14316-
<div algorithm>
14317-
The abstract operation <dfn abstract-op>SetSyntheticModuleExport</dfn>(|module|, |exportName|,
14318-
|exportValue|) can be used to set or change the exported value for a pre-established export of a
14319-
Synthetic Module Record.
14320-
It performs the following steps:
14321-
14322-
1. Let |envRec| be |module|.\[[Environment]]'s [=Lexical Environment/EnvironmentRecord=].
14323-
1. Perform |envRec|.[$Environment Record/SetMutableBinding$](|exportName|, |exportValue|,
14324-
<emu-val>true</emu-val>).
14325-
</div>
14326-
14327-
<h4 id="smr-concrete-methods">Concrete Methods</h4>
14328-
14329-
The following are the concrete methods for [=Synthetic Module Record=] that implement the
14330-
corresponding [=Module Record=] abstract methods.
14331-
14332-
<h5 id="smr-getexportednames">GetExportedNames</h5>
14333-
14334-
<div algorithm>
14335-
The <dfn abstract-op for="Synthetic Module Record">GetExportedNames</dfn>(<var
14336-
ignore>exportStarSet</var>) concrete method of a [=Synthetic Module Record=] implements the
14337-
corresponding [=Module Record=] abstract method.
14338-
14339-
It performs the following steps:
14340-
14341-
1. Let |module| be this [=Synthetic Module Record=].
14342-
1. Return |module|.\[[ExportNames]].
14343-
</div>
14344-
14345-
<h5 id="smr-resolveexport">ResolveExport</h5>
14346-
14347-
<div algorithm>
14348-
The <dfn abstract-op for="Synthetic Module Record">ResolveExport</dfn>(|exportName|, <var
14349-
ignore>resolveSet</var>) concrete method of a [=Synthetic Module Record=] implements the
14350-
corresponding [=Module Record=] abstract method.
14351-
14352-
It performs the following steps:
14353-
14354-
1. Let |module| be this [=Synthetic Module Record=].
14355-
1. If |module|.\[[ExportNames]] does not contain |exportName|, return <emu-val>null</emu-val>.
14356-
1. Return [=ResolvedBinding Record=] { \[[Module]]: |module|, \[[BindingName]]: |exportName| }.
14357-
</div>
14358-
14359-
<h5 id="smr-Link">Link</h5>
14360-
14361-
<div algorithm>
14362-
The <dfn abstract-op for="Synthetic Module Record">Link</dfn>() concrete method of a
14363-
[=Synthetic Module Record=] implements the corresponding [=Module Record=] abstract method.
14364-
14365-
It performs the following steps:
14366-
14367-
1. Let |module| be this [=Synthetic Module Record=].
14368-
1. Let |realm| be |module|.\[[Realm]].
14369-
1. Assert: |realm| is not <emu-val>undefined</emu-val>.
14370-
1. Let |env| be [$NewModuleEnvironment$](|realm|.\[[GlobalEnv]]).
14371-
1. Set |module|.\[[Environment]] to |env|.
14372-
1. Let |envRec| be |env|'s [=Lexical Environment/EnvironmentRecord=].
14373-
1. For each |exportName| in |module|.\[[ExportNames]],
14374-
1. Perform [=!=] |envRec|.[$Environment Record/CreateMutableBinding$](|exportName|,
14375-
<emu-val>false</emu-val>).
14376-
1. Perform [=!=] |envRec|.[$Environment Record/InitializeBinding$](|exportName|,
14377-
<emu-val>undefined</emu-val>).
14378-
1. Return <emu-val>undefined</emu-val>.
14379-
</div>
14380-
14381-
<h5 id="smr-evaluate">Evaluate</h5>
14382-
14383-
<div algorithm>
14384-
The <dfn abstract-op for="Synthetic Module Record">Evaluate</dfn>() concrete method of a
14385-
[=Synthetic Module Record=] implements the corresponding [=Module Record=] abstract method.
14386-
14387-
It performs the following steps:
14388-
14389-
1. Let |module| be this [=Synthetic Module Record=].
14390-
1. Let |moduleCxt| be a new [=ECMAScript code execution context=].
14391-
1. Set the [=Execution context/Function=] of |moduleCxt| to <emu-val>null</emu-val>.
14392-
1. Assert: |module|.\[[Realm]] is not <emu-val>undefined</emu-val>.
14393-
1. Set the [=Execution context/Realm=] of |moduleCxt| to |module|.\[[Realm]].
14394-
1. Set the [=Execution context/ScriptOrModule=] of |moduleCxt| to |module|.
14395-
1. Set the [=ECMAScript code execution context/VariableEnvironment=] of |moduleCxt| to
14396-
|module|.\[[Environment]].
14397-
1. Set the [=ECMAScript code execution context/LexicalEnvironment=] of |moduleCxt| to
14398-
|module|.\[[Environment]].
14399-
1. Suspend the currently [=running execution context=].
14400-
1. Push |moduleCxt| on to the [=execution context stack=]; |moduleCxt| is now the
14401-
[=running execution context=].
14402-
1. Let |completion| be the result of performing |module|.\[[EvaluationSteps]](|module|).
14403-
1. Suspend |moduleCxt| and remove it from the [=execution context stack=].
14404-
1. Resume the context that is now on the top of the [=execution context stack=] as the
14405-
[=running execution context=].
14406-
1. Return [$Completion$](|completion|).
14407-
</div>
14408-
14409-
1441014242
<h2 id="common">Common definitions</h2>
1441114243

1441214244
This section specifies some common definitions that all

0 commit comments

Comments
 (0)