Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit

Permalink
Updates based on ecma262 PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Jun 24, 2021
1 parent 7b5399a commit 4d57bbc
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 17 deletions.
11 changes: 11 additions & 0 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ <h1>Miscellaneous</h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-ordinary-and-exotic-objects-behaviours">
<h1>Ordinary and Exotic Objects Behaviours</h1>
<emu-clause id="sec-ecmascript-function-objects">
<h1>ECMAScript Function Objects</h1>
<emu-clause id="sec-ecmascript-function-objects-call-thisargument-argumentslist">
<h1>[[Call]] ( _thisArgument_, _argumentsList_ )</h1>
<emu-import href="sec-runtime-semantics-evaluatebody-patch.html"></emu-import>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause id="sec-ecmascript-language-statements-and-declarations">
<h1>ECMAScript Language: Statements and Declarations</h1>
<emu-clause id="sec-continue-statement">
Expand Down
101 changes: 87 additions & 14 deletions spec/sec-class-definitions-patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>ClassStaticBlockBody: ClassStaticBlockStatementList</emu-grammar>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of |ClassStaticBlockStatementList| contains any duplicate entries.</p>
It is a Syntax Error if the LexicallyDeclaredNames of |ClassStaticBlockStatementList| contains any duplicate entries.
</li>
<li>
<p>It is a Syntax Error if any element of the LexicallyDeclaredNames of |ClassStaticBlockStatementList| also occurs in the VarDeclaredNames of |ClassStaticBlockStatementList|.</p>
It is a Syntax Error if any element of the LexicallyDeclaredNames of |ClassStaticBlockStatementList| also occurs in the VarDeclaredNames of |ClassStaticBlockStatementList|.
</li>
<li>
<p>It is a Syntax Error if ContainsDuplicateLabels of |ClassStaticBlockStatementList| with argument &laquo; &raquo; is *true*.</p>
It is a Syntax Error if ContainsDuplicateLabels of |ClassStaticBlockStatementList| with argument &laquo; &raquo; is *true*.
</li>
<li>
<p>It is a Syntax Error if ContainsUndefinedBreakTarget of |ClassStaticBlockStatementList| with argument &laquo; &raquo; is *true*.</p>
It is a Syntax Error if ContainsUndefinedBreakTarget of |ClassStaticBlockStatementList| with argument &laquo; &raquo; is *true*.
</li>
<li>
<p>It is a Syntax Error if ContainsUndefinedContinueTarget of |ClassStaticBlockStatementList| with arguments &laquo; &raquo; and &laquo; &raquo; is *true*.</p>
It is a Syntax Error if ContainsUndefinedContinueTarget of |ClassStaticBlockStatementList| with arguments &laquo; &raquo; and &laquo; &raquo; is *true*.
</li>
<li>
<p>It is a Syntax Error if ContainsArguments of |ClassStaticBlockStatementList| is *true*.</p>
It is a Syntax Error if ContainsArguments of |ClassStaticBlockStatementList| is *true*.
</li>
<li>
<p>It is a Syntax Error if |ClassStaticBlockStatementList| Contains |SuperCall| is *true*.</p>
It is a Syntax Error if |ClassStaticBlockStatementList| Contains |SuperCall| is *true*.
</li>
<li>
<p>It is a Syntax Error if ContainsAwait of |ClassStaticBlockStatementList| is *true*.</p>
It is a Syntax Error if ContainsAwait of |ClassStaticBlockStatementList| is *true*.
</li>
</ul>
</ins>
Expand Down Expand Up @@ -113,6 +113,63 @@ <h1>Static Semantics: IsStatic</h1>
</emu-alg>
</emu-clause>


<emu-clause id="sec-static-semantics-privateboundidentifiers" type="sdo" aoid="PrivateBoundIdentifiers">
<h1>Static Semantics: PrivateBoundIdentifiers</h1>
<emu-grammar>
FieldDefinition : ClassElementName Initializer?
</emu-grammar>
<emu-alg>
1. Return PrivateBoundIdentifiers of |ClassElementName|.
</emu-alg>

<emu-grammar>
ClassElementName : PrivateIdentifier
</emu-grammar>
<emu-alg>
1. Return a List whose sole element is the StringValue of |PrivateIdentifier|.
</emu-alg>

<emu-grammar>
ClassElementName : PropertyName

<ins>ClassElement : ClassStaticBlock</ins>

ClassElement : `;`
</emu-grammar>
<emu-alg>
1. Return a new empty List.
</emu-alg>

<emu-grammar>
ClassElementList : ClassElementList ClassElement
</emu-grammar>
<emu-alg>
1. Let _names_ be PrivateBoundIdentifiers of |ClassElementList|.
1. Append to _names_ the elements of PrivateBoundIdentifiers of |ClassElement|.
1. Return _names_.
</emu-alg>

<emu-grammar>
MethodDefinition :
ClassElementName `(` UniqueFormalParameters `)` `{` FunctionBody `}`
`get` ClassElementName `(` `)` `{` FunctionBody `}`
`set` ClassElementName `(` PropertySetParameterList `)` `{` FunctionBody `}`

GeneratorMethod :
`*` ClassElementName `(` UniqueFormalParameters `)` `{` GeneratorBody `}`

AsyncMethod :
`async` ClassElementName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`

AsyncGeneratorMethod :
`async` `*` ClassElementName `(` UniqueFormalParameters `)` `{` AsyncGeneratorBody `}`
</emu-grammar>
<emu-alg>
1. Return PrivateBoundIdentifiers of |ClassElementName|.
</emu-alg>
</emu-clause>

<emu-clause id="sec-static-semantics-containsawait" type="sdo" aoid="ContainsAwait">
<h1><ins>Static Semantics: ContainsAwait</ins></h1>

Expand Down Expand Up @@ -218,7 +275,7 @@ <h1><ins>Static Semantics: ComputedPropertyContainsAwait</ins></h1>
</emu-alg>
<emu-grammar>PropertyName : ComputedPropertyName</emu-grammar>
<emu-alg>
1. Return the result of ComputedPropertyContainsAwait for |ComputedPropertyName|.
1. Return the result of ContainsAwait for |ComputedPropertyName|.
</emu-alg>
<emu-grammar>
MethodDefinition :
Expand All @@ -242,7 +299,11 @@ <h1><ins>Static Semantics: ComputedPropertyContainsAwait</ins></h1>
1. Let ComputedPropertyContainsAwait for |ClassElementList| is *true*, return *true*.
1. Return the result of ComputedPropertyContainsAwait for |ClassElement|.
</emu-alg>
<emu-grammar>ClassElement : `;`</emu-grammar>
<emu-grammar>
ClassElement : ClassStaticBlock

ClassElement : `;`
</emu-grammar>
<emu-alg>
1. Return *false*.
</emu-alg>
Expand Down Expand Up @@ -270,11 +331,23 @@ <h1><ins>Runtime Semantics: ClassStaticBlockDefinitionEvaluation</ins></h1>
1. Let _lex_ be the running execution context's LexicalEnvironment.
1. Let _privateScope_ be the running execution context's PrivateEnvironment.
1. Let _sourceText_ be the empty sequence of Unicode code points.
1. Let _body_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, &laquo; &raquo;, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateScope_).
1. Perform MakeMethod(_body_, _homeObject_).
1. Return the ClassStaticBlockDefinition Record { [[Body]]: _body_ }.
1. Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, &laquo; &raquo;, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateScope_).
1. Perform MakeMethod(_bodyFunction_, _homeObject_).
1. Return the ClassStaticBlockDefinition Record { [[BodyFunction]]: _bodyFunction_ }.
</emu-alg>
<emu-note>The function created for _bodyFunction_ is never directly accessible to ECMAScript code.</emu-note>
</ins>
</emu-clause>

<emu-clause id="sec-runtime-semantics-evaluateclassstaticblockbody" type="sdo" aoid="EvaluateClassStaticBlockBody">
<h1><ins>Runtime Semantics: EvaluateClassStaticBlockBody</ins></h1>
<ins class="block">
<p>With parameter _functionObject_.</p>
<emu-grammar>ClassStaticBlockBody : ClassStaticBlockStatementList</emu-grammar>
<emu-alg>
1. Perform ? FunctionDeclarationInstantiation(_functionObject_, &laquo; &raquo;).
1. Return the result of evaluating |ClassStaticBlockStatementList|.
</emu-alg>
<emu-note>The function created for _body_ is never directly accessible to ECMAScript code.</emu-note>
</ins>
</emu-clause>

Expand Down
2 changes: 1 addition & 1 deletion spec/sec-ecmascript-specification-types-patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1><ins>ClassStaticBlockDefinition Records</ins></h1>
</tr>
<tr>
<td>
[[Body]]
[[BodyFunction]]
</td>
<td>
An function object.
Expand Down
2 changes: 1 addition & 1 deletion spec/sec-operations-on-objects-patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1><ins>EvaluateStaticBlock ( _receiver_ , _blockRecord_ )</ins></h1>
<emu-alg>
1. Assert: Type(_receiver_) is Object.
1. Assert: _blockRecord_ is a ClassStaticBlockDefinition Record.
1. Perform ? Call(_blockRecord_.[[Body]], _receiver_).
1. Perform ? Call(_blockRecord_.[[BodyFunction]], _receiver_).
</emu-alg>
</ins>
</emu-clause>
Expand Down
60 changes: 60 additions & 0 deletions spec/sec-runtime-semantics-evaluatebody-patch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<emu-clause id="sec-runtime-semantics-evaluatebody" type="sdo" aoid="EvaluateBody">
<h1>Runtime Semantics: EvaluateBody</h1>
<p>With parameters _functionObject_ and _argumentsList_ (a List).</p>
<emu-grammar>FunctionBody : FunctionStatementList</emu-grammar>
<emu-alg>
1. Return ? EvaluateFunctionBody of |FunctionBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>ConciseBody : ExpressionBody</emu-grammar>
<emu-alg>
1. Return ? EvaluateConciseBody of |ConciseBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>GeneratorBody : FunctionBody</emu-grammar>
<emu-alg>
1. Return ? EvaluateGeneratorBody of |GeneratorBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>
AsyncGeneratorBody : FunctionBody
</emu-grammar>
<emu-alg>
1. Return ? EvaluateAsyncGeneratorBody of |AsyncGeneratorBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>
AsyncFunctionBody : FunctionBody
</emu-grammar>
<emu-alg>
1. Return ? EvaluateAsyncFunctionBody of |AsyncFunctionBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>
AsyncConciseBody : ExpressionBody
</emu-grammar>
<emu-alg>
1. Return ? EvaluateAsyncConciseBody of |AsyncConciseBody| with arguments _functionObject_ and _argumentsList_.
</emu-alg>
<emu-grammar>
Initializer :
`=` AssignmentExpression
</emu-grammar>
<emu-alg>
1. Assert: _argumentsList_ is empty.
1. Assert: _functionObject_.[[ClassFieldInitializerName]] is not ~empty~.
1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then
1. Let _value_ be NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]].
1. Else,
1. Let _rhs_ be the result of evaluating |AssignmentExpression|.
1. Let _value_ be ? GetValue(_rhs_).
1. Return Completion { [[Type]]: ~return~, [[Value]]: _value_, [[Target]]: ~empty~ }.
</emu-alg>
<emu-note>
<p>Even though field initializers constitute a function boundary, calling FunctionDeclarationInstantiation does not have any observable effect and so is omitted.</p>
</emu-note>
<ins class="block">
<emu-grammar>
ClassStaticBlockBody : ClassStaticBlockStatementList
</emu-grammar>
<emu-grammar>
1. Assert: _argumentsList_ is empty.
1. Return ? EvaluateClassStaticBlockBody of |ClassStaticBlockBody| with argument _functionObject_.
</emu-grammar>
</ins>
</emu-clause>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h1>Static Semantics: LexicallyDeclaredNames</h1>
1. Return TopLevelLexicallyDeclaredNames of |StatementList|.
</emu-alg>
<ins class="block">
<emu-grammar>ClassStaticBlockStatementList: [empty]</emu-grammar>
<emu-grammar>ClassStaticBlockStatementList : [empty]</emu-grammar>
<emu-alg>
1. Return a new empty List.
</emu-alg>
Expand Down

0 comments on commit 4d57bbc

Please sign in to comment.