Skip to content

Commit

Permalink
Change Evaluation to forward to NamedEvaluation for anonymous functions
Browse files Browse the repository at this point in the history
  • Loading branch information
anba committed Mar 18, 2020
1 parent 2367ce3 commit 9479155
Showing 1 changed file with 7 additions and 44 deletions.
51 changes: 7 additions & 44 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -19837,12 +19837,7 @@ <h1>Runtime Semantics: Evaluation</h1>
</emu-alg>
<emu-grammar>FunctionExpression : `function` `(` FormalParameters `)` `{` FunctionBody `}`</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, |FormalParameters|, |FunctionBody|, ~non-lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Perform MakeConstructor(_closure_).
1. Set _closure_.[[SourceText]] to the source text matched by |FunctionExpression|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |FunctionExpression| with argument *""*.
</emu-alg>
<emu-grammar>FunctionExpression : `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}`</emu-grammar>
<emu-alg>
Expand Down Expand Up @@ -20132,12 +20127,7 @@ <h1>Runtime Semantics: NamedEvaluation</h1>
<h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>ArrowFunction : ArrowParameters `=&gt;` ConciseBody</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _parameters_ be CoveredFormalsList of |ArrowParameters|.
1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _parameters_, |ConciseBody|, ~lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Set _closure_.[[SourceText]] to the source text matched by |ArrowFunction|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |ArrowFunction| with argument *""*.
</emu-alg>
<emu-note>
<p>An |ArrowFunction| does not define local bindings for `arguments`, `super`, `this`, or `new.target`. Any reference to `arguments`, `super`, `this`, or `new.target` within an |ArrowFunction| must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an |ArrowFunction| may contain references to `super`, the function object created in step 3 is not made into a method by performing MakeMethod. An |ArrowFunction| that references `super` is always contained within a non-|ArrowFunction| and the necessary state to implement `super` is accessible via the _scope_ that is captured by the function object of the |ArrowFunction|.</p>
Expand Down Expand Up @@ -20593,13 +20583,7 @@ <h1>Runtime Semantics: NamedEvaluation</h1>
<h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>GeneratorExpression : `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}`</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _closure_ be OrdinaryFunctionCreate(%Generator%, |FormalParameters|, |GeneratorBody|, ~non-lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Let _prototype_ be OrdinaryObjectCreate(%Generator.prototype%).
1. Perform DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1. Set _closure_.[[SourceText]] to the source text matched by |GeneratorExpression|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |GeneratorExpression| with argument *""*.
</emu-alg>
<emu-grammar>GeneratorExpression : `function` `*` BindingIdentifier `(` FormalParameters `)` `{` GeneratorBody `}`</emu-grammar>
<emu-alg>
Expand Down Expand Up @@ -20934,13 +20918,7 @@ <h1>Runtime Semantics: Evaluation</h1>
AsyncGeneratorExpression : `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`
</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncGenerator%, |FormalParameters|, |AsyncGeneratorBody|, ~non-lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Let _prototype_ be ! OrdinaryObjectCreate(%AsyncGenerator.prototype%).
1. Perform ! DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1. Set _closure_.[[SourceText]] to the source text matched by |AsyncGeneratorExpression|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |AsyncGeneratorExpression| with argument *""*.
</emu-alg>

<emu-grammar>
Expand Down Expand Up @@ -21600,11 +21578,7 @@ <h1>Runtime Semantics: Evaluation</h1>
AsyncFunctionExpression : `async` `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, |FormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |AsyncFunctionExpression| with argument *""*.
</emu-alg>

<emu-grammar>
Expand Down Expand Up @@ -21894,24 +21868,13 @@ <h1>Runtime Semantics: Evaluation</h1>
AsyncArrowFunction : `async` AsyncArrowBindingIdentifier `=>` AsyncConciseBody
</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _parameters_ be |AsyncArrowBindingIdentifier|.
1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, _parameters_, |AsyncConciseBody|, ~lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Set _closure_.[[SourceText]] to the source text matched by |AsyncArrowFunction|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |AsyncArrowFunction| with argument *""*.
</emu-alg>
<emu-grammar>
AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead `=>` AsyncConciseBody
</emu-grammar>
<emu-alg>
1. Let _scope_ be the LexicalEnvironment of the running execution context.
1. Let _head_ be CoveredAsyncArrowHead of |CoverCallExpressionAndAsyncArrowHead|.
1. Let _parameters_ be the |ArrowFormalParameters| of _head_.
1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, _parameters_, |AsyncConciseBody|, ~lexical-this~, _scope_).
1. Perform SetFunctionName(_closure_, *""*).
1. Set _closure_.[[SourceText]] to the source text matched by |AsyncArrowFunction|.
1. Return _closure_.
1. Return the result of performing NamedEvaluation for this |AsyncArrowFunction| with argument *""*.
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down

0 comments on commit 9479155

Please sign in to comment.