Skip to content

Commit

Permalink
Editorial: Fix null [[ScriptOrModule]] of function declarations in mo…
Browse files Browse the repository at this point in the history
…dules
  • Loading branch information
devsnek committed Aug 15, 2019
1 parent 8f0f692 commit ea4cbc2
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -5980,6 +5980,36 @@ <h1>CreateGlobalFunctionBinding ( _N_, _V_, _D_ )</h1>
<emu-clause id="sec-module-environment-records">
<h1>Module Environment Records</h1>
<p>A module Environment Record is a declarative Environment Record that is used to represent the outer scope of an ECMAScript |Module|. In additional to normal mutable and immutable bindings, module Environment Records also provide immutable import bindings which are bindings that provide indirect access to a target binding that exists in another Environment Record.</p>
<p>Module Environment Records have the additional state fields listed in <emu-xref href="#table-additional-fields-of-module-environments"></emu-xref>.</p>
<emu-table id="table-additional-fields-of-module-environments" caption="Additional Fields of Module Environment Records">
<table>
<tbody>
<tr>
<th>
Field Name
</th>
<th>
Value
</th>
<th>
Meaning
</th>
</tr>
<tr>
<td>
[[Module]]
</td>
<td>
Any
</td>
<td>
The module this environment is associated with.
</td>
</tr>
</tr>
</tbody>
</table>
</emu-table>
<p>Module Environment Records support all of the declarative Environment Record methods listed in <emu-xref href="#table-15"></emu-xref> and share the same specifications for all of those methods except for GetBindingValue, DeleteBinding, HasThisBinding and GetThisBinding. In addition, module Environment Records support the methods listed in <emu-xref href="#table-20"></emu-xref>:</p>
<emu-table id="table-20" caption="Additional Methods of Module Environment Records">
<table>
Expand Down Expand Up @@ -6158,11 +6188,12 @@ <h1>NewGlobalEnvironment ( _G_, _thisValue_ )</h1>
</emu-clause>

<emu-clause id="sec-newmoduleenvironment" aoid="NewModuleEnvironment">
<h1>NewModuleEnvironment ( _E_ )</h1>
<h1>NewModuleEnvironment ( _E_, _module_ )</h1>
<p>When the abstract operation NewModuleEnvironment is called with a Lexical Environment argument _E_ the following steps are performed:</p>
<emu-alg>
1. Let _env_ be a new Lexical Environment.
1. Let _envRec_ be a new module Environment Record containing no bindings.
1. Set _envRec_.[[Module]] to _module_.
1. Set _env_'s EnvironmentRecord to _envRec_.
1. Set the outer lexical environment reference of _env_ to _E_.
1. Return _env_.
Expand Down Expand Up @@ -7507,7 +7538,12 @@ <h1>FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
1. Set _F_.[[Environment]] to _Scope_.
1. Set _F_.[[FormalParameters]] to _ParameterList_.
1. Set _F_.[[ECMAScriptCode]] to _Body_.
1. Set _F_.[[ScriptOrModule]] to GetActiveScriptOrModule().
1. Let _activeScriptOrModule_ be GetActiveScriptOrModule().
1. If _activeScriptOrModule_ is *null*,
1. Let _envRec_ be _Scope_'s EnvironmentRecord.
1. Assert: _envRec_ is a Module Environment Record.
1. Set _activeScriptOrModule_ to _envRec_.[[Module]].
1. Set _F_.[[ScriptOrModule]] to _activeScriptOrModule_.
1. If _kind_ is ~Arrow~, set _F_.[[ThisMode]] to ~lexical~.
1. Else if _Strict_ is *true*, set _F_.[[ThisMode]] to ~strict~.
1. Else, set _F_.[[ThisMode]] to ~global~.
Expand Down Expand Up @@ -22579,7 +22615,7 @@ <h1>InitializeEnvironment ( ) Concrete Method</h1>
1. Assert: All named exports from _module_ are resolvable.
1. Let _realm_ be _module_.[[Realm]].
1. Assert: _realm_ is not *undefined*.
1. Let _env_ be NewModuleEnvironment(_realm_.[[GlobalEnv]]).
1. Let _env_ be NewModuleEnvironment(_realm_.[[GlobalEnv]], _module_).
1. Set _module_.[[Environment]] to _env_.
1. Let _envRec_ be _env_'s EnvironmentRecord.
1. For each ImportEntry Record _in_ in _module_.[[ImportEntries]], do
Expand Down

0 comments on commit ea4cbc2

Please sign in to comment.