Class Fields: Updating frontmatter

This commit is contained in:
Rick Waldron 2018-07-30 17:15:03 -04:00 committed by Leo Balter
parent 5d014bdfba
commit 90e8859cdd
33 changed files with 145 additions and 195 deletions

View File

@ -19,8 +19,8 @@ info: |
2. Assert: Assert constructor is an ECMAScript function object. 2. Assert: Assert constructor is an ECMAScript function object.
3. Let fieldRecords be the value of constructor's [[Fields]] internal slot. 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
4. For each item fieldRecord in order from fieldRecords, 4. For each item fieldRecord in order from fieldRecords,
a. If fieldRecord.[[static]] is false, then a. Perform ? DefineField(O, fieldRecord).
i. Perform ? DefineField(O, fieldRecord). 5. Return.
DefineField(receiver, fieldRecord) DefineField(receiver, fieldRecord)
... ...
@ -32,6 +32,7 @@ info: |
2. If O is not an object, throw a TypeError exception. 2. If O is not an object, throw a TypeError exception.
3. Let entry be PrivateFieldFind(P, O). 3. Let entry be PrivateFieldFind(P, O).
4. If entry is not empty, throw a TypeError exception. 4. If entry is not empty, throw a TypeError exception.
...
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -8,12 +8,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -9,12 +9,12 @@ info: |
GetValue ( V ) GetValue ( V )
... ...
5. If IsPropertyReference(V), then 5. If IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.
ii. Let field be ? ResolveBinding(GetReferencedName(V), env). ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
iii. Assert: field is a Private Name. iii. Assert: field is a Private Name.
iv. Return ? PrivateFieldGet(field, base). iv. Return ? PrivateFieldGet(field, base).
PrivateFieldGet (P, O ) PrivateFieldGet (P, O )
1. Assert: P is a Private Name value. 1. Assert: P is a Private Name value.

View File

@ -7,7 +7,7 @@ esid: sec-putvalue
info: | info: |
PutValue ( V, W ) PutValue ( V, W )
... ...
5. Else if IsPropertyReference(V), then 6. Else if IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.

View File

@ -7,7 +7,7 @@ esid: sec-putvalue
info: | info: |
PutValue ( V, W ) PutValue ( V, W )
... ...
5. Else if IsPropertyReference(V), then 6. Else if IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.

View File

@ -8,7 +8,7 @@ esid: sec-putvalue
info: | info: |
PutValue ( V, W ) PutValue ( V, W )
... ...
5. Else if IsPropertyReference(V), then 6. Else if IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.

View File

@ -7,7 +7,7 @@ esid: sec-putvalue
info: | info: |
PutValue ( V, W ) PutValue ( V, W )
... ...
5. Else if IsPropertyReference(V), then 6. Else if IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.

View File

@ -7,7 +7,7 @@ esid: sec-putvalue
info: | info: |
PutValue ( V, W ) PutValue ( V, W )
... ...
5. Else if IsPropertyReference(V), then 6. Else if IsPropertyReference(V), then
... ...
b. If IsPrivateReference(V), then b. If IsPrivateReference(V), then
i. Let env be the running execution context's PrivateNameEnvironment. i. Let env be the running execution context's PrivateNameEnvironment.

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename in constructor without being declared in class fields description: Early error when referencing privatename in constructor without being declared in class fields
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename in function in class without declaring in field description: Early error when referencing privatename in function in class without declaring in field
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename that has not been declared in class. description: Early error when referencing privatename that has not been declared in class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private, class-fields-public] features: [class, class-fields-private, class-fields-public]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename that has not been declared in class. description: Early error when referencing privatename that has not been declared in class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename outside of class description: Early error when referencing privatename outside of class
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename outside of class. description: Early error when referencing privatename outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename on object, outside of class. description: Early error when referencing privatename on object, outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class-fields-private] features: [class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,10 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename on object, outside of class. description: Early error when referencing privatename on object, outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
... It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class-fields-private] features: [class-fields-private]
negative: negative:
phase: parse phase: parse

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename in constructor without being declared in class fields description: Early error when referencing privatename in constructor without being declared in class fields
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename in function in class without declaring in field description: Early error when referencing privatename in function in class without declaring in field
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename that has not been declared in class. description: Early error when referencing privatename that has not been declared in class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private, class-fields-public] features: [class, class-fields-private, class-fields-public]
---*/ ---*/

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename that has not been declared in class. description: Early error when referencing privatename that has not been declared in class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename outside of class description: Early error when referencing privatename outside of class
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -5,15 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename outside of class. description: Early error when referencing privatename outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
Script : ScriptBody ScriptBody : StatementList
1. Let names be an empty List.
2. If Script is parsed directly from PerformEval, It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
a. Let env be the running execution context's PrivateNameEnvironment.
b. Repeat while env is not null,
i. For each binding named N in env,
1. If names does not contain N, append N to names.
ii. Let env be env's outer environment reference.
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
features: [class, class-fields-private] features: [class, class-fields-private]
---*/ ---*/

View File

@ -5,9 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename on object, outside of class. description: Early error when referencing privatename on object, outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
1. Let names be an empty List. ScriptBody : StatementList
...
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception. It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
features: [class-fields-private] features: [class-fields-private]
---*/ ---*/

View File

@ -5,9 +5,10 @@ esid: sec-scripts-static-semantics-early-errors
description: Early error when referencing privatename on object, outside of class. description: Early error when referencing privatename on object, outside of class.
info: | info: |
Static Semantics: Early Errors Static Semantics: Early Errors
1. Let names be an empty List. ScriptBody : StatementList
...
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception. It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
features: [class-fields-private] features: [class-fields-private]
---*/ ---*/

View File

@ -1,16 +1,11 @@
// Copyright (C) 2017 Valerie Young. All rights reserved. // Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-scripts-static-semantics-early-errors esid: sec-all-private-names-valid
description: Referencing privatename in class within class does not error. description: Referencing privatename in class within class does not error.
info: | info: |
Static Semantics: Early Errors
Script : ScriptBody
1. Let names be an empty List.
...
3. If AllPrivateNamesValid of ScriptBody with the argument names is false, throw a SyntaxError exception.
Static Semantics: AllPrivateNamesValid Static Semantics: AllPrivateNamesValid
AllPrivateNamesValid is an abstract operation which takes names as an argument. AllPrivateNamesValid is an abstract operation which takes names as an argument.
MemberExpression : MemberExpression . PrivateName MemberExpression : MemberExpression . PrivateName
@ -21,9 +16,9 @@ info: |
1. If StringValue of PrivateName is in names, return true. 1. If StringValue of PrivateName is in names, return true.
2. Return false. 2. Return false.
ClassBody:ClassElementList ClassBody : ClassElementList
1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
2.Return AllPrivateNamesValid of ClassElementList with the argument newNames. 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
For all other grammatical productions, recurse on subexpressions/substatements, passing in the names of the caller. If all pieces return true, then return true. If any returns false, return false. For all other grammatical productions, recurse on subexpressions/substatements, passing in the names of the caller. If all pieces return true, then return true. If any returns false, return false.

View File

@ -9,26 +9,17 @@ info: |
... ...
27. For each ClassElement e in order from elements 27. For each ClassElement e in order from elements
a. If IsStatic of e is false, then a. If IsStatic of e is false, then
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. i. Let fields be the result of performing ClassElementEvaluation
for e with arguments proto and false.
b. Else, b. Else,
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. i. Let fields be the result of performing ClassElementEvaluation
for e with arguments F and false.
c. If fields is an abrupt completion, then c. If fields is an abrupt completion, then
i. Set the running execution context's LexicalEnvironment to lex. i. Set the running execution context's LexicalEnvironment to lex.
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
iii. Return Completion(status). iii. Return Completion(status).
Runtime Semantics: ClassElementEvaluation features: [class-static-fields-public]
...
ClassElement : static FieldDefinition ;
1. Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
Runtime Semantics: ClassFieldDefinitionEvaluation
With parameters isStatic and homeObject.
FieldDefinition : ClassElementNameInitializer
1. Let fieldName be the result of evaluating ClassElementName.
2. ReturnIfAbrupt(fieldName).
features: [class-fields]
---*/ ---*/
function f() { function f() {

View File

@ -7,28 +7,19 @@ esid: runtime-semantics-class-definition-evaluation
info: | info: |
Runtime Semantics: ClassDefinitionEvaluation Runtime Semantics: ClassDefinitionEvaluation
... ...
33. Let result be InitializeStaticFields(F). 27. For each ClassElement e in order from elements
34. If result is an abrupt completion, then a. If IsStatic of e is false, then
a. Set the running execution context's LexicalEnvironment to lex. i. Let fields be the result of performing ClassElementEvaluation
b. Return Completion(result). for e with arguments proto and false.
b. Else,
i. Let fields be the result of performing ClassElementEvaluation
for e with arguments F and false.
c. If fields is an abrupt completion, then
i. Set the running execution context's LexicalEnvironment to lex.
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
iii. Return Completion(status).
InitializeStaticFields(F) features: [class-static-fields-public]
1. Assert: Type(F) is Object.
2. Assert: F is an ECMAScript function object.
3. Let fieldRecords be the value of F's [[Fields]] internal slot.
4. For each item fieldRecord in order from fieldRecords,
a. If fieldRecord.[[static]] is true, then
i. Perform ? DefineField(F, fieldRecord).
DefineField(receiver, fieldRecord)
1. Assert: Type(receiver) is Object.
2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
3. Let fieldName be fieldRecord.[[Name]].
4. Let initializer be fieldRecord.[[Initializer]].
5. If initializer is not empty, then
a. Let initValue be ? Call(initializer, receiver).
features: [class-fields]
---*/ ---*/
function f() { function f() {
@ -39,4 +30,4 @@ assert.throws(Test262Error, function() {
class C { class C {
static x = f(); static x = f();
} }
}) });