Skip to content

Commit 8eba4e1

Browse files
committed
Editorial: Fix null [[ScriptOrModule]] of function declarations in modules
1 parent 8f0f692 commit 8eba4e1

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

spec.html

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7497,7 +7497,7 @@ <h1>FunctionAllocate ( _functionPrototype_, _functionKind_ )</h1>
74977497
</emu-clause>
74987498

74997499
<emu-clause id="sec-functioninitialize" aoid="FunctionInitialize">
7500-
<h1>FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
7500+
<h1>FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ [ , _module_ ])</h1>
75017501
<p>The abstract operation FunctionInitialize requires the arguments: a function object _F_, _kind_ which is one of (Normal, Method, Arrow), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. FunctionInitialize performs the following steps:</p>
75027502
<emu-alg>
75037503
1. Let _len_ be the ExpectedArgumentCount of _ParameterList_.
@@ -7507,7 +7507,8 @@ <h1>FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
75077507
1. Set _F_.[[Environment]] to _Scope_.
75087508
1. Set _F_.[[FormalParameters]] to _ParameterList_.
75097509
1. Set _F_.[[ECMAScriptCode]] to _Body_.
7510-
1. Set _F_.[[ScriptOrModule]] to GetActiveScriptOrModule().
7510+
1. If _module_ is present, set _F_.[[ScriptOrModule]] to _module_.
7511+
1. Otherwise, set _F_.[[ScriptOrModule]] to GetActiveScriptOrModule().
75117512
1. If _kind_ is ~Arrow~, set _F_.[[ThisMode]] to ~lexical~.
75127513
1. Else if _Strict_ is *true*, set _F_.[[ThisMode]] to ~strict~.
75137514
1. Else, set _F_.[[ThisMode]] to ~global~.
@@ -7516,45 +7517,45 @@ <h1>FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
75167517
</emu-clause>
75177518

75187519
<emu-clause id="sec-functioncreate" aoid="FunctionCreate">
7519-
<h1>FunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ [ , _prototype_ ] )</h1>
7520+
<h1>FunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ [ , _prototype_ ] [ , _module_ ] )</h1>
75207521
<p>The abstract operation FunctionCreate requires the arguments: _kind_ which is one of (Normal, Method, Arrow), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_, and optionally, an object _prototype_. FunctionCreate performs the following steps:</p>
75217522
<emu-alg>
75227523
1. If _prototype_ is not present, then
75237524
1. Set _prototype_ to %Function.prototype%.
75247525
1. If _kind_ is not ~Normal~, let _allocKind_ be `"non-constructor"`.
75257526
1. Else, let _allocKind_ be `"normal"`.
75267527
1. Let _F_ be FunctionAllocate(_prototype_, _allocKind_).
7527-
1. Return FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_).
7528+
1. Return FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_, _module_).
75287529
</emu-alg>
75297530
</emu-clause>
75307531

75317532
<emu-clause id="sec-generatorfunctioncreate" aoid="GeneratorFunctionCreate">
7532-
<h1>GeneratorFunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
7533+
<h1>GeneratorFunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ [ , module ])</h1>
75337534
<p>The abstract operation GeneratorFunctionCreate requires the arguments: _kind_ which is one of (Normal, Method), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. GeneratorFunctionCreate performs the following steps:</p>
75347535
<emu-alg>
75357536
1. Let _functionPrototype_ be %Generator%.
75367537
1. Let _F_ be FunctionAllocate(_functionPrototype_, `"generator"`).
7537-
1. Return FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_).
7538+
1. Return FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_, _module_).
75387539
</emu-alg>
75397540
</emu-clause>
75407541

75417542
<emu-clause id="sec-asyncgeneratorfunctioncreate" aoid="AsyncGeneratorFunctionCreate">
7542-
<h1>AsyncGeneratorFunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ )</h1>
7543+
<h1>AsyncGeneratorFunctionCreate ( _kind_, _ParameterList_, _Body_, _Scope_ [ , _module_ ] )</h1>
75437544
<p>The abstract operation AsyncGeneratorFunctionCreate requires the arguments: _kind_ which is one of (~Normal~, ~Method~), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. AsyncGeneratorFunctionCreate performs the following steps:</p>
75447545
<emu-alg>
75457546
1. Let _functionPrototype_ be %AsyncGenerator%.
75467547
1. Let _F_ be ! FunctionAllocate(_functionPrototype_, `"generator"`).
7547-
1. Return ! FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_).
7548+
1. Return ! FunctionInitialize(_F_, _kind_, _ParameterList_, _Body_, _Scope_, _module_).
75487549
</emu-alg>
75497550
</emu-clause>
75507551

75517552
<emu-clause id="sec-async-functions-abstract-operations-async-function-create" aoid="AsyncFunctionCreate">
7552-
<h1>AsyncFunctionCreate ( _kind_, _parameters_, _body_, _Scope_ )</h1>
7553+
<h1>AsyncFunctionCreate ( _kind_, _parameters_, _body_, _Scope_ [ , _module_ ] )</h1>
75537554
<p>The abstract operation AsyncFunctionCreate requires the arguments: _kind_ which is one of (~Normal~, ~Method~, ~Arrow~), a parameter list Parse Node specified by _parameters_, a body Parse Node specified by _body_, a Lexical Environment specified by _Scope_. AsyncFunctionCreate performs the following steps:</p>
75547555
<emu-alg>
75557556
1. Let _functionPrototype_ be %AsyncFunction.prototype%.
75567557
2. Let _F_ be ! FunctionAllocate(_functionPrototype_, `"async"`).
7557-
3. Return ! FunctionInitialize(_F_, _kind_, _parameters_, _body_, _Scope_).
7558+
3. Return ! FunctionInitialize(_F_, _kind_, _parameters_, _body_, _Scope_, _module_).
75587559
</emu-alg>
75597560
</emu-clause>
75607561

@@ -18534,20 +18535,20 @@ <h1>Runtime Semantics: IteratorBindingInitialization</h1>
1853418535

1853518536
<emu-clause id="sec-function-definitions-runtime-semantics-instantiatefunctionobject">
1853618537
<h1>Runtime Semantics: InstantiateFunctionObject</h1>
18537-
<p>With parameter _scope_.</p>
18538+
<p>With parameter _scope_ and optional parameter _module_.</p>
1853818539
<emu-see-also-para op="InstantiateFunctionObject"></emu-see-also-para>
1853918540
<emu-grammar>FunctionDeclaration : `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}`</emu-grammar>
1854018541
<emu-alg>
1854118542
1. Let _name_ be StringValue of |BindingIdentifier|.
18542-
1. Let _F_ be FunctionCreate(~Normal~, |FormalParameters|, |FunctionBody|, _scope_).
18543+
1. Let _F_ be FunctionCreate(~Normal~, |FormalParameters|, |FunctionBody|, _scope_, _module_).
1854318544
1. Perform MakeConstructor(_F_).
1854418545
1. Perform SetFunctionName(_F_, _name_).
1854518546
1. Set _F_.[[SourceText]] to the source text matched by |FunctionDeclaration|.
1854618547
1. Return _F_.
1854718548
</emu-alg>
1854818549
<emu-grammar>FunctionDeclaration : `function` `(` FormalParameters `)` `{` FunctionBody `}`</emu-grammar>
1854918550
<emu-alg>
18550-
1. Let _F_ be FunctionCreate(~Normal~, |FormalParameters|, |FunctionBody|, _scope_).
18551+
1. Let _F_ be FunctionCreate(~Normal~, |FormalParameters|, |FunctionBody|, _scope_, _module_).
1855118552
1. Perform MakeConstructor(_F_).
1855218553
1. Perform SetFunctionName(_F_, `"default"`).
1855318554
1. Set _F_.[[SourceText]] to the source text matched by |FunctionDeclaration|.
@@ -19249,12 +19250,12 @@ <h1>Runtime Semantics: EvaluateBody</h1>
1924919250

1925019251
<emu-clause id="sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject">
1925119252
<h1>Runtime Semantics: InstantiateFunctionObject</h1>
19252-
<p>With parameter _scope_.</p>
19253+
<p>With parameter _scope_ and optional parameter _module_.</p>
1925319254
<emu-see-also-para op="InstantiateFunctionObject"></emu-see-also-para>
1925419255
<emu-grammar>GeneratorDeclaration : `function` `*` BindingIdentifier `(` FormalParameters `)` `{` GeneratorBody `}`</emu-grammar>
1925519256
<emu-alg>
1925619257
1. Let _name_ be StringValue of |BindingIdentifier|.
19257-
1. Let _F_ be GeneratorFunctionCreate(~Normal~, |FormalParameters|, |GeneratorBody|, _scope_).
19258+
1. Let _F_ be GeneratorFunctionCreate(~Normal~, |FormalParameters|, |GeneratorBody|, _scope_, _module_).
1925819259
1. Let _prototype_ be ObjectCreate(%GeneratorPrototype%).
1925919260
1. Perform DefinePropertyOrThrow(_F_, `"prototype"`, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1926019261
1. Perform SetFunctionName(_F_, _name_).
@@ -19263,7 +19264,7 @@ <h1>Runtime Semantics: InstantiateFunctionObject</h1>
1926319264
</emu-alg>
1926419265
<emu-grammar>GeneratorDeclaration : `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}`</emu-grammar>
1926519266
<emu-alg>
19266-
1. Let _F_ be GeneratorFunctionCreate(~Normal~, |FormalParameters|, |GeneratorBody|, _scope_).
19267+
1. Let _F_ be GeneratorFunctionCreate(~Normal~, |FormalParameters|, |GeneratorBody|, _scope_, _module_).
1926719268
1. Let _prototype_ be ObjectCreate(%GeneratorPrototype%).
1926819269
1. Perform DefinePropertyOrThrow(_F_, `"prototype"`, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1926919270
1. Perform SetFunctionName(_F_, `"default"`).
@@ -19575,13 +19576,13 @@ <h1>Runtime Semantics: EvaluateBody</h1>
1957519576

1957619577
<emu-clause id="sec-asyncgenerator-definitions-instantiatefunctionobject">
1957719578
<h1>Runtime Semantics: InstantiateFunctionObject</h1>
19578-
<p>With parameter _scope_.</p>
19579+
<p>With parameter _scope_ and optional parameter _module_.</p>
1957919580
<emu-grammar>
1958019581
AsyncGeneratorDeclaration : `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}`
1958119582
</emu-grammar>
1958219583
<emu-alg>
1958319584
1. Let _name_ be StringValue of |BindingIdentifier|.
19584-
1. Let _F_ be ! AsyncGeneratorFunctionCreate(~Normal~, |FormalParameters|, |AsyncGeneratorBody|, _scope_).
19585+
1. Let _F_ be ! AsyncGeneratorFunctionCreate(~Normal~, |FormalParameters|, |AsyncGeneratorBody|, _scope_, _module_).
1958519586
1. Let _prototype_ be ! ObjectCreate(%AsyncGeneratorPrototype%).
1958619587
1. Perform ! DefinePropertyOrThrow(_F_, `"prototype"`, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1958719588
1. Perform ! SetFunctionName(_F_, _name_).
@@ -19593,7 +19594,7 @@ <h1>Runtime Semantics: InstantiateFunctionObject</h1>
1959319594
AsyncGeneratorDeclaration : `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`
1959419595
</emu-grammar>
1959519596
<emu-alg>
19596-
1. Let _F_ be AsyncGeneratorFunctionCreate(~Normal~, |FormalParameters|, |AsyncGeneratorBody|, _scope_).
19597+
1. Let _F_ be AsyncGeneratorFunctionCreate(~Normal~, |FormalParameters|, |AsyncGeneratorBody|, _scope_, _module_).
1959719598
1. Let _prototype_ be ObjectCreate(%AsyncGeneratorPrototype%).
1959819599
1. Perform DefinePropertyOrThrow(_F_, `"prototype"`, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1959919600
1. Perform SetFunctionName(_F_, `"default"`).
@@ -20222,13 +20223,13 @@ <h1>Static Semantics: PropName</h1>
2022220223

2022320224
<emu-clause id="sec-async-function-definitions-InstantiateFunctionObject">
2022420225
<h1>Runtime Semantics: InstantiateFunctionObject</h1>
20225-
<p>With parameter _scope_.</p>
20226+
<p>With parameter _scope_ and optional parameter _module_.</p>
2022620227
<emu-grammar>
2022720228
AsyncFunctionDeclaration : `async` `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
2022820229
</emu-grammar>
2022920230
<emu-alg>
2023020231
1. Let _name_ be StringValue of |BindingIdentifier|.
20231-
1. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_).
20232+
1. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _module_).
2023220233
1. Perform ! SetFunctionName(_F_, _name_).
2023320234
1. Set _F_.[[SourceText]] to the source text matched by |AsyncFunctionDeclaration|.
2023420235
1. Return _F_.
@@ -20237,7 +20238,7 @@ <h1>Runtime Semantics: InstantiateFunctionObject</h1>
2023720238
AsyncFunctionDeclaration : `async` `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
2023820239
</emu-grammar>
2023920240
<emu-alg>
20240-
1. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_).
20241+
1. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _module_).
2024120242
1. Perform ! SetFunctionName(_F_, `"default"`).
2024220243
1. Set _F_.[[SourceText]] to the source text matched by |AsyncFunctionDeclaration|.
2024320244
1. Return _F_.
@@ -22610,7 +22611,7 @@ <h1>InitializeEnvironment ( ) Concrete Method</h1>
2261022611
1. Else,
2261122612
1. Perform ! _envRec_.CreateMutableBinding(_dn_, *false*).
2261222613
1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then
22613-
1. Let _fo_ be InstantiateFunctionObject of _d_ with argument _env_.
22614+
1. Let _fo_ be InstantiateFunctionObject of _d_ with argument _env_ and _module_.
2261422615
1. Call _envRec_.InitializeBinding(_dn_, _fo_).
2261522616
1. Return NormalCompletion(~empty~).
2261622617
</emu-alg>

0 commit comments

Comments
 (0)