diff --git a/spec/modified-productions.htm b/spec/modified-productions.htm index 97576fe..21eeb34 100644 --- a/spec/modified-productions.htm +++ b/spec/modified-productions.htm @@ -99,9 +99,10 @@

Runtime Semantics: ClassDefinitionEvaluation

1. Let _publicFieldRecords_ be a new empty List. 1. For each item _publicField_ in order from _publicFields_, 1. Let _isStatic_ be the result of performing IsStatic of _publicField_. - 1. Let _fieldRecord_ be the result of performing - ClassPublicFieldDefinitionEvaluation for _publicField_ with argument - _isStatic_. + 1. If _isStatic_, let _homeObject_ be _F_, otherwise let _homeObject_ be _proto_. + 1. Let _fieldRecord_ be the result of performing + ClassPublicFieldDefinitionEvaluation for _publicField_ with arguments + _isStatic_ and _homeObject_. 1. Append _fieldRecord_ to _publicFieldRecords_. 1. Set the value of _F_'s [[PublicFields]] internal slot to _publicFieldRecords_. 1. Set the running execution context's LexicalEnvironment to _classScope_. diff --git a/spec/new-productions.htm b/spec/new-productions.htm index 3c643ea..eed10a9 100644 --- a/spec/new-productions.htm +++ b/spec/new-productions.htm @@ -9,18 +9,6 @@

|PublicFieldDefinition|

- -

Static Semantics: Early Errors

- - PublicFieldDefinition : - PropertyName[?Yield] Initializer? - - - 1. It is a SyntaxError if |Initializer| contains |MetaProperty|. - 1. It is a SyntaxError if |Initializer| contains an |Identifier| with the StringValue `"arguments"`. - -
-

Static Semantics: ClassPublicFields

@@ -51,14 +39,17 @@

Static Semantics: ClassPublicFields

ClassPublicFieldDefinitionEvaluation

-

With parameter _isStatic_.

+

With parameters _isStatic_ and _homeObject_.

PublicFieldDefinition : PropertyName[?Yield] Initializer? 1. Let _fieldName_ be the result of performing PropName of |PropertyName|. - 1. If |Initializer_opt| is present, let _initializer_ be |Initializer_opt| + 1. If |Initializer_opt| is present, + 1. Let _lex_ be the Lexical Environment of the running execution context. + 1. Let _initializer_ be FunctionCreate(~Method~, ~empty~, |Initializer_opt|, _lex_, *true*). + 1. Perform MakeMethod(_initializer_, _homeObject_). 1. Else, let _initializer_ be ~empty~. 1. Return Record{ [[name]]: _fieldName_, @@ -68,6 +59,20 @@

ClassPublicFieldDefinitionEvaluation

+ +

Runtime Semantics: EvaluateBody

+ +

With parameter _functionObject_.

+ + + Initializer[In, Yield] : + `=` AssignmentExpression[?In, ?Yield] + + + 1. Return the result of evaluating |AssignmentExpression|. + +
+

InitializePublicStaticFields(_F_)

@@ -80,10 +85,7 @@

InitializePublicStaticFields(_F_)

1. Let _fieldName_ be _fieldRecord_.[[name]]. 1. Let _initializer_ be _fieldRecord_.[[initializer]]. 1. If _initializer_ is not ~empty~, then - 1. Let _result_ be the result of evaluating _initializer_. - 1. Let _initValue_ be the result of GetValue(_result_). - 1. If _initValue_ is an abrupt completion, return - Completion(_initValue_). + 1. Let _initValue_ be ? Call(_initializer_, *undefined*). 1. Else, let _initValue_ be *undefined*. 1. Let _desc_ be PropertyDescriptor { [[configurable]]: *false*, @@ -112,31 +114,22 @@

InitializePublicInstanceFields ( _O_, _constructor_ )

1. Assert: Type ( _O_ ) is Object. 1. Assert: Assert _constructor_ is an ECMAScript function object. - 1. Let _lex_ be the Lexical Environment of the running execution context. - 1. Let _initializerEnv_ be NewFunctionEnvironment ( _constructor_, *undefined* ). - 1. Let _initializerEnvRec_ be the value of _initializerEnv_'s EnvironmentRecord. - 1. Perform ! _initializerEnvRec_.CreateImmutableBinding(`"arguments"`, ~false~). - 1. Perform ! _initializerEnvRec_.InitializeBinding(`"arguments"`, ~undefined~). - 1. Perform _initializerER_.BindThisValue ( _O_ ). - 1. Set the running execution context's LexicalEnvironment to _initializerEnv_. 1. Let _publicFieldRecords_ be the value of _constructor_'s [[PublicFields]] internal slot. 1. For each item _fieldRecord_ in order from _publicFieldRecords_, 1. If _fieldRecord_.[[static]] is *false*, then 1. Let _fieldName_ be _fieldRecord_.[[name]] 1. Let _initializer_ be _fieldRecord_.[[initializer]]. 1. If _initializer_ is not ~empty~, then - 1. Let _result_ be the result of evaluating _initializer_. - 1. Let _initValue_ be GetValue(_result_). - 1. If _initValue_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _lex_. - 1. Return Completion(_initValue_). - 1. Let _desc_ be PropertyDescriptor { - [[configurable]]: *false*, - [[enumerable]]: *true*, - [[writable]]: *true*, - [[value]]: _initValue_ - } - 1. Perform ?DefinePropertyOrThrow (_O_, _fieldName_, _desc_) + 1. Let _initValue_ be ? Call(_initializer_, _O_). + 1. Else, + 1. Let _initValue_ be ~undefined~. + 1. Let _desc_ be PropertyDescriptor { + [[configurable]]: *false*, + [[enumerable]]: *true*, + [[writable]]: *true*, + [[value]]: _initValue_ + } + 1. Perform ? DefinePropertyOrThrow (_O_, _fieldName_, _desc_) 1. Set the running execution context's LexicalEnvironment to _lex_. 1. Return.