From 4d57bbc0cf29a2a8f2d57e5389e7c68a24786821 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 24 Jun 2021 13:45:21 -0700 Subject: [PATCH] Updates based on ecma262 PR feedback --- spec/index.html | 11 ++ spec/sec-class-definitions-patch.html | 101 +++++++++++++++--- ...-ecmascript-specification-types-patch.html | 2 +- spec/sec-operations-on-objects-patch.html | 2 +- ...-runtime-semantics-evaluatebody-patch.html | 60 +++++++++++ ...emantics-lexicallydeclarednames-patch.html | 2 +- 6 files changed, 161 insertions(+), 17 deletions(-) create mode 100644 spec/sec-runtime-semantics-evaluatebody-patch.html diff --git a/spec/index.html b/spec/index.html index 3ba8c07..211e918 100644 --- a/spec/index.html +++ b/spec/index.html @@ -55,6 +55,17 @@

Miscellaneous

+ +

Ordinary and Exotic Objects Behaviours

+ +

ECMAScript Function Objects

+ +

[[Call]] ( _thisArgument_, _argumentsList_ )

+ +
+
+
+

ECMAScript Language: Statements and Declarations

diff --git a/spec/sec-class-definitions-patch.html b/spec/sec-class-definitions-patch.html index d76d206..45e8fb6 100644 --- a/spec/sec-class-definitions-patch.html +++ b/spec/sec-class-definitions-patch.html @@ -28,28 +28,28 @@

Static Semantics: Early Errors

ClassStaticBlockBody: ClassStaticBlockStatementList
  • -

    It is a Syntax Error if the LexicallyDeclaredNames of |ClassStaticBlockStatementList| contains any duplicate entries.

    + It is a Syntax Error if the LexicallyDeclaredNames of |ClassStaticBlockStatementList| contains any duplicate entries.
  • -

    It is a Syntax Error if any element of the LexicallyDeclaredNames of |ClassStaticBlockStatementList| also occurs in the VarDeclaredNames of |ClassStaticBlockStatementList|.

    + It is a Syntax Error if any element of the LexicallyDeclaredNames of |ClassStaticBlockStatementList| also occurs in the VarDeclaredNames of |ClassStaticBlockStatementList|.
  • -

    It is a Syntax Error if ContainsDuplicateLabels of |ClassStaticBlockStatementList| with argument « » is *true*.

    + It is a Syntax Error if ContainsDuplicateLabels of |ClassStaticBlockStatementList| with argument « » is *true*.
  • -

    It is a Syntax Error if ContainsUndefinedBreakTarget of |ClassStaticBlockStatementList| with argument « » is *true*.

    + It is a Syntax Error if ContainsUndefinedBreakTarget of |ClassStaticBlockStatementList| with argument « » is *true*.
  • -

    It is a Syntax Error if ContainsUndefinedContinueTarget of |ClassStaticBlockStatementList| with arguments « » and « » is *true*.

    + It is a Syntax Error if ContainsUndefinedContinueTarget of |ClassStaticBlockStatementList| with arguments « » and « » is *true*.
  • -

    It is a Syntax Error if ContainsArguments of |ClassStaticBlockStatementList| is *true*.

    + It is a Syntax Error if ContainsArguments of |ClassStaticBlockStatementList| is *true*.
  • -

    It is a Syntax Error if |ClassStaticBlockStatementList| Contains |SuperCall| is *true*.

    + It is a Syntax Error if |ClassStaticBlockStatementList| Contains |SuperCall| is *true*.
  • -

    It is a Syntax Error if ContainsAwait of |ClassStaticBlockStatementList| is *true*.

    + It is a Syntax Error if ContainsAwait of |ClassStaticBlockStatementList| is *true*.
@@ -113,6 +113,63 @@

Static Semantics: IsStatic

+ + +

Static Semantics: PrivateBoundIdentifiers

+ + FieldDefinition : ClassElementName Initializer? + + + 1. Return PrivateBoundIdentifiers of |ClassElementName|. + + + + ClassElementName : PrivateIdentifier + + + 1. Return a List whose sole element is the StringValue of |PrivateIdentifier|. + + + + ClassElementName : PropertyName + + ClassElement : ClassStaticBlock + + ClassElement : `;` + + + 1. Return a new empty List. + + + + ClassElementList : ClassElementList ClassElement + + + 1. Let _names_ be PrivateBoundIdentifiers of |ClassElementList|. + 1. Append to _names_ the elements of PrivateBoundIdentifiers of |ClassElement|. + 1. Return _names_. + + + + 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 `}` + + + 1. Return PrivateBoundIdentifiers of |ClassElementName|. + +
+

Static Semantics: ContainsAwait

@@ -218,7 +275,7 @@

Static Semantics: ComputedPropertyContainsAwait

PropertyName : ComputedPropertyName - 1. Return the result of ComputedPropertyContainsAwait for |ComputedPropertyName|. + 1. Return the result of ContainsAwait for |ComputedPropertyName|. MethodDefinition : @@ -242,7 +299,11 @@

Static Semantics: ComputedPropertyContainsAwait

1. Let ComputedPropertyContainsAwait for |ClassElementList| is *true*, return *true*. 1. Return the result of ComputedPropertyContainsAwait for |ClassElement|. - ClassElement : `;` + + ClassElement : ClassStaticBlock + + ClassElement : `;` + 1. Return *false*. @@ -270,11 +331,23 @@

Runtime Semantics: ClassStaticBlockDefinitionEvaluation

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_, « », |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_, « », |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateScope_). + 1. Perform MakeMethod(_bodyFunction_, _homeObject_). + 1. Return the ClassStaticBlockDefinition Record { [[BodyFunction]]: _bodyFunction_ }. + + The function created for _bodyFunction_ is never directly accessible to ECMAScript code. + +
+ + +

Runtime Semantics: EvaluateClassStaticBlockBody

+ +

With parameter _functionObject_.

+ ClassStaticBlockBody : ClassStaticBlockStatementList + + 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, « »). + 1. Return the result of evaluating |ClassStaticBlockStatementList|. - The function created for _body_ is never directly accessible to ECMAScript code.
diff --git a/spec/sec-ecmascript-specification-types-patch.html b/spec/sec-ecmascript-specification-types-patch.html index 6c30ed3..5819190 100644 --- a/spec/sec-ecmascript-specification-types-patch.html +++ b/spec/sec-ecmascript-specification-types-patch.html @@ -21,7 +21,7 @@

ClassStaticBlockDefinition Records

- [[Body]] + [[BodyFunction]] An function object. diff --git a/spec/sec-operations-on-objects-patch.html b/spec/sec-operations-on-objects-patch.html index 2a6c26f..d117ae9 100644 --- a/spec/sec-operations-on-objects-patch.html +++ b/spec/sec-operations-on-objects-patch.html @@ -6,7 +6,7 @@

EvaluateStaticBlock ( _receiver_ , _blockRecord_ )

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_).
diff --git a/spec/sec-runtime-semantics-evaluatebody-patch.html b/spec/sec-runtime-semantics-evaluatebody-patch.html new file mode 100644 index 0000000..78ab8e6 --- /dev/null +++ b/spec/sec-runtime-semantics-evaluatebody-patch.html @@ -0,0 +1,60 @@ + +

Runtime Semantics: EvaluateBody

+

With parameters _functionObject_ and _argumentsList_ (a List).

+ FunctionBody : FunctionStatementList + + 1. Return ? EvaluateFunctionBody of |FunctionBody| with arguments _functionObject_ and _argumentsList_. + + ConciseBody : ExpressionBody + + 1. Return ? EvaluateConciseBody of |ConciseBody| with arguments _functionObject_ and _argumentsList_. + + GeneratorBody : FunctionBody + + 1. Return ? EvaluateGeneratorBody of |GeneratorBody| with arguments _functionObject_ and _argumentsList_. + + + AsyncGeneratorBody : FunctionBody + + + 1. Return ? EvaluateAsyncGeneratorBody of |AsyncGeneratorBody| with arguments _functionObject_ and _argumentsList_. + + + AsyncFunctionBody : FunctionBody + + + 1. Return ? EvaluateAsyncFunctionBody of |AsyncFunctionBody| with arguments _functionObject_ and _argumentsList_. + + + AsyncConciseBody : ExpressionBody + + + 1. Return ? EvaluateAsyncConciseBody of |AsyncConciseBody| with arguments _functionObject_ and _argumentsList_. + + + Initializer : + `=` AssignmentExpression + + + 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~ }. + + +

Even though field initializers constitute a function boundary, calling FunctionDeclarationInstantiation does not have any observable effect and so is omitted.

+
+ + + ClassStaticBlockBody : ClassStaticBlockStatementList + + + 1. Assert: _argumentsList_ is empty. + 1. Return ? EvaluateClassStaticBlockBody of |ClassStaticBlockBody| with argument _functionObject_. + + +
diff --git a/spec/sec-static-semantics-lexicallydeclarednames-patch.html b/spec/sec-static-semantics-lexicallydeclarednames-patch.html index 00e40ee..665806f 100644 --- a/spec/sec-static-semantics-lexicallydeclarednames-patch.html +++ b/spec/sec-static-semantics-lexicallydeclarednames-patch.html @@ -68,7 +68,7 @@

Static Semantics: LexicallyDeclaredNames

1. Return TopLevelLexicallyDeclaredNames of |StatementList|. - ClassStaticBlockStatementList: [empty] + ClassStaticBlockStatementList : [empty] 1. Return a new empty List.