-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Allow [[ReferencedName]] in Reference Records to be a not-yet-resolved property key #3307
Normative: Allow [[ReferencedName]] in Reference Records to be a not-yet-resolved property key #3307
Conversation
spec.html
Outdated
@@ -19147,8 +19153,7 @@ <h1> | |||
<emu-alg> | |||
1. Let _propertyNameReference_ be ? Evaluation of _expression_. | |||
1. Let _propertyNameValue_ be ? GetValue(_propertyNameReference_). | |||
1. Let _propertyKey_ be ? ToPropertyKey(_propertyNameValue_). | |||
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. | |||
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyNameValue_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyNameValue_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. | |
1. NOTE: In most cases, ToPropertyKey(_propertyNameValue_) will be performed immediately after this step. However, in the case of `a[b] = c`, it will not be performed until after evaluation of `c`. | |
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyNameValue_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...though it seems like the linter thinks we're performing ToPropertyKey(_propertyNameValue_)
instead of mentioning it in a NOTE. 🤔 Tried rephrasing to ditch the parens.
spec.html
Outdated
@@ -19147,8 +19153,7 @@ <h1> | |||
<emu-alg> | |||
1. Let _propertyNameReference_ be ? Evaluation of _expression_. | |||
1. Let _propertyNameValue_ be ? GetValue(_propertyNameReference_). | |||
1. Let _propertyKey_ be ? ToPropertyKey(_propertyNameValue_). | |||
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. | |||
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyNameValue_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same change is necessary for super
:
class C extends class {} {
m() {
super[{toString() { console.log('ToPropertyKey'); } }] = console.log('rhs');
}
}
(new C).m()
prints 'rhs' then 'ToPropertyKey'.
Calls to Alternatively, these could be changed to pass |
Looks good other than those comments, thanks for doing this! |
82117e4
to
4d1a4b5
Compare
This means the test linked in the referenced issue will be invalidated and needs to be updated or removed, correct? |
That is correct. If anybody's gung-ho to do it, I won't stop 'em, but otherwise I can do so. 😉 |
Update S11.13.1_A7_T3.js now that consensus has been reached on tc39/ecma262#3307.
Corresponding test262 PR: tc39/test262#4052 |
Update S11.13.1_A7_T3.js now that consensus has been reached on tc39/ecma262#3307.
* Update test for o[p] = f() Update S11.13.1_A7_T3.js now that consensus has been reached on tc39/ecma262#3307. * Rename test and add an analogous one for super.
We should update these tests and also add a test for this case before merging. |
Ensure that the following cases are covered: - tc39/ecma262#3295 (comment) - tc39/ecma262#2659 (comment)
Ensure that the following cases are covered: - tc39/ecma262#3295 (comment) - tc39/ecma262#2659 (comment)
Ensure that the following cases are covered: - tc39/ecma262#3295 (comment) - tc39/ecma262#2659 (comment)
Done! tc39/test262#4060 |
Ensure that the following cases are covered: - tc39/ecma262#3295 (comment) - tc39/ecma262#2659 (comment)
The additional tests are merged. |
@@ -4264,6 +4264,9 @@ <h1> | |||
1. [id="step-getvalue-toobject"] Let _baseObj_ be ? ToObject(_V_.[[Base]]). | |||
1. If IsPrivateReference(_V_) is *true*, then | |||
1. Return ? PrivateGet(_baseObj_, _V_.[[ReferencedName]]). | |||
1. If _V_.[[ReferencedName]] is neither a String nor a Symbol, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. If _V_.[[ReferencedName]] is neither a String nor a Symbol, then | |
1. If IsPropertyKey(_V_.[[ReferencedName]]) is *false*, then |
Alternatively, I'm not sure why we have that AO instead of just saying "is a property key", since "property key" is a well-defined term. So we could get rid of that AO (as a separate PR) and then just use that phrasing.
Same below for PutValue
, of course.
edit: Also evaluation of delete
🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good; opened #3316.
<td>a String, a Symbol, or a Private Name</td> | ||
<td>The name of the binding. Always a String if [[Base]] value is an Environment Record.</td> | ||
<td>an ECMAScript language value or a Private Name</td> | ||
<td>The name of the binding. Always a String if [[Base]] value is an Environment Record. May temporarily be an ECMAScript language value other than a String or a Symbol in the case of a property reference for which ToPropertyKey has yet to be performed.</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a sentence of the form "May be an ECMAScript language value [...] until yada yada" would be clearer than "May temporarily be [...]".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good; added an Otherwise,
to your suggestion to clarify that this just applies to property reference cases.
spec.html
Outdated
@@ -20501,7 +20507,7 @@ <h1>Runtime Semantics: Evaluation</h1> | |||
1. If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then | |||
1. Let _lref_ be ? Evaluation of |LeftHandSideExpression|. | |||
1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) and IsIdentifierRef of |LeftHandSideExpression| are both *true*, then | |||
1. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. | |||
1. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument StringValue of |LeftHandSideExpression|. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Here and below, this reads a bit awkward given the invocation of the SDO. Perhaps pull out a separate step like Let _lhs_ be the StringValue of |LeftHandSideExpression|.
Very weak preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: we already wanted to do this for other reasons. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
spec.html
Outdated
@@ -20501,7 +20507,8 @@ <h1>Runtime Semantics: Evaluation</h1> | |||
1. If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then | |||
1. Let _lref_ be ? Evaluation of |LeftHandSideExpression|. | |||
1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) and IsIdentifierRef of |LeftHandSideExpression| are both *true*, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this doesn't have to be part of this PR, but we should update this line to match the other cases below.
1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) and IsIdentifierRef of |LeftHandSideExpression| are both *true*, then | |
1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone ahead and opened a separate PR for it here: #3330
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…yet-resolved property key (tc39#3307)
7e98c0e
to
6e70429
Compare
Missing coverage encountered while implementing <tc39/ecma262#3307> in SpiderMonkey. Ensure environment lookups are performed in the correct order: - keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js Ensure `delete super[elem]` steps are correctly performed: - delete/super-property-topropertykey.js - delete/super-property-uninitialized-this.js Ensure ToPropertyKey for computed property names in object literals correctly performed: - object/computed-property-name-topropertykey-before-value-evaluation.js Ensure `GetSuperBase` is executed before `ToPropertKey`: - super/prop-expr-getsuperbase-before-topropertykey-* Ensure `GetThisBinding` is executed first: - super/prop-expr-uninitialized-this-*
Missing coverage encountered while implementing <tc39/ecma262#3307> in SpiderMonkey. Ensure environment lookups are performed in the correct order: - keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js Ensure `delete super[elem]` steps are correctly performed: - delete/super-property-topropertykey.js - delete/super-property-uninitialized-this.js Ensure ToPropertyKey for computed property names in object literals correctly performed: - object/computed-property-name-topropertykey-before-value-evaluation.js Ensure `GetSuperBase` is executed before `ToPropertKey`: - super/prop-expr-getsuperbase-before-topropertykey-* Ensure `GetThisBinding` is executed first: - super/prop-expr-uninitialized-this-*
Missing coverage encountered while implementing <tc39/ecma262#3307> in SpiderMonkey. Ensure environment lookups are performed in the correct order: - keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js Ensure `delete super[elem]` steps are correctly performed: - delete/super-property-topropertykey.js - delete/super-property-uninitialized-this.js Ensure ToPropertyKey for computed property names in object literals correctly performed: - object/computed-property-name-topropertykey-before-value-evaluation.js Ensure `GetSuperBase` is executed before `ToPropertKey`: - super/prop-expr-getsuperbase-before-topropertykey-* Ensure `GetThisBinding` is executed first: - super/prop-expr-uninitialized-this-*
Missing coverage encountered while implementing <tc39/ecma262#3307> in SpiderMonkey. Ensure environment lookups are performed in the correct order: - keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js Ensure `delete super[elem]` steps are correctly performed: - delete/super-property-topropertykey.js - delete/super-property-uninitialized-this.js Ensure ToPropertyKey for computed property names in object literals correctly performed: - object/computed-property-name-topropertykey-before-value-evaluation.js Ensure `GetSuperBase` is executed before `ToPropertKey`: - super/prop-expr-getsuperbase-before-topropertykey-* Ensure `GetThisBinding` is executed first: - super/prop-expr-uninitialized-this-*
Resolves #3295.