Skip to content
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

Restore early SyntaxError for strict mode assignment to eval/arguments #1132

Merged
merged 1 commit into from
Aug 1, 2018

Conversation

anba
Copy link
Contributor

@anba anba commented Mar 6, 2018

@anba
Copy link
Contributor Author

anba commented Mar 6, 2018

spec.html Outdated
@@ -14451,13 +14457,19 @@ <h1>Static Semantics: Early Errors</h1>
It is a Syntax Error if |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral| and |LeftHandSideExpression| is not covering an |AssignmentPattern|.
</li>
<li>
It is an early Reference Error if |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral| and IsValidSimpleAssignmentTarget of |LeftHandSideExpression| is *false*.
It is an early Reference Error if |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral| and IsValidSimpleAssignmentTarget of |LeftHandSideExpression| is ~invalid~.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems strange to have something named as a predicate (IsValidSimpleAssignmentTarget) not be a boolean. Should this be renamed to something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimpleAssignmentTarget, AssignmentTarget{Type,Hint} should do the trick or whatever @anba decides works for me as well.

For anything else, this PR LGTM. +1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssignTargetType: +1

@littledan littledan added normative change Affects behavior required to correctly evaluate some ECMAScript source text needs test262 tests The proposal should specify how to test an implementation. Ideally via github.com/tc39/test262 labels Mar 6, 2018
@littledan
Copy link
Member

Thanks for following up on this old issue and helping us get aligned with web reality. LGTM, seems like an accurate fix of the linked bug. Test262 tests would be great.

@anba
Copy link
Contributor Author

anba commented Apr 12, 2018

Test262 tests would be great.

Already covered by:

  • test/language/arguments-object/10.5-1-s.js
  • test/language/arguments-object/10.5-1gs.js
  • test/language/arguments-object/10.5-7-b-1-s.js
  • test/language/directive-prologue/14.1-4gs.js
  • test/language/directive-prologue/14.1-5gs.js
  • test/language/expressions/assignment/dstr-array-elem-target-simple-strict.js
  • test/language/expressions/assignment/dstr-obj-id-init-simple-strict.js
  • test/language/expressions/assignment/dstr-obj-id-simple-strict.js
  • test/language/expressions/assignment/id-arguments-strict.js
  • test/language/expressions/assignment/id-eval-strict.js
  • test/language/expressions/compound-assignment/11.13.2-6-1-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-10-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-11-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-12-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-13-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-14-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-15-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-16-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-17-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-18-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-19-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-1gs.js
  • test/language/expressions/compound-assignment/11.13.2-6-2-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-20-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-21-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-22-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-3-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-4-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-5-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-6-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-7-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-8-s.js
  • test/language/expressions/compound-assignment/11.13.2-6-9-s.js
  • test/language/expressions/postfix-decrement/11.3.2-2-1-s.js
  • test/language/expressions/postfix-decrement/11.3.2-2-2-s.js
  • test/language/expressions/postfix-increment/11.3.1-2-1-s.js
  • test/language/expressions/postfix-increment/11.3.1-2-1gs.js
  • test/language/expressions/postfix-increment/11.3.1-2-2-s.js
  • test/language/expressions/prefix-decrement/11.4.5-2-1-s.js
  • test/language/expressions/prefix-decrement/11.4.5-2-2-s.js
  • test/language/expressions/prefix-decrement/11.4.5-2-2gs.js
  • test/language/expressions/prefix-increment/11.4.4-2-1-s.js
  • test/language/expressions/prefix-increment/11.4.4-2-2-s.js
  • test/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict.js
  • test/language/statements/for-in/dstr-array-elem-target-simple-strict.js
  • test/language/statements/for-in/dstr-obj-id-init-simple-strict.js
  • test/language/statements/for-in/dstr-obj-id-simple-strict.js
  • test/language/statements/for-of/dstr-array-elem-target-simple-strict.js
  • test/language/statements/for-of/dstr-obj-id-init-simple-strict.js
  • test/language/statements/for-of/dstr-obj-id-simple-strict.js
  • test/language/statements/function/13.0-13-s.js
  • test/language/statements/function/13.0-14-s.js
  • test/language/statements/function/13.0-15-s.js
  • test/language/statements/function/13.0-16-s.js
  • test/language/statements/function/13.0-7-s.js
  • test/language/statements/function/13.0-8-s.js
  • test/language/statements/function/13.0_4-5gs.js
  • test/language/statements/function/enable-strict-via-body.js
  • test/language/statements/function/enable-strict-via-outer-body.js
  • test/language/statements/function/enable-strict-via-outer-script.js
  • test/language/statements/variable/12.2.1-13-s.js
  • test/language/statements/variable/12.2.1-15-s.js
  • test/language/statements/variable/12.2.1-19-s.js
  • test/language/statements/variable/12.2.1-2-s.js
  • test/language/statements/variable/12.2.1-4-s.js
  • test/language/statements/variable/12.2.1-8-s.js

@littledan littledan added has test262 tests and removed needs test262 tests The proposal should specify how to test an implementation. Ideally via github.com/tc39/test262 labels Apr 12, 2018
@littledan
Copy link
Member

OK, it seems like this was an accidental change vs previous versions, corresponds to implementation consensus and tests, and simply restores things from before the typo. I think we should consider this patch ready to land.

spec.html Outdated
@@ -13064,7 +13064,10 @@ <h1>Static Semantics: Early Errors</h1>
</emu-grammar>
<ul>
<li>
It is an early Reference Error if IsValidSimpleAssignmentTarget of |LeftHandSideExpression| is *false*.
It is an early Reference Error if IsValidSimpleAssignmentTarget of |LeftHandSideExpression| is ~invalid~.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be renamed to not have an “is” prefix` on an enum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the editor's call, we decided to rename this to "AssignmentTargetType". I'll take care of this as part of the rebase and merge.

Copy link
Member

@bmeck bmeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should change name, otherwise +1

@ljharb ljharb assigned ljharb and unassigned bterlson Aug 1, 2018
@ljharb ljharb force-pushed the invalid-strict-mode-assign branch from 2272bfb to 02f414c Compare August 1, 2018 19:11
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the name, as well as all the relevant section names and their IDs, and preserved the oldids.

@ljharb ljharb merged commit 02f414c into tc39:master Aug 1, 2018
It is an early Reference Error if AssignmentTargetType of |UnaryExpression| is ~invalid~.
</li>
<li>
It is an early Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is ~strict~.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1423.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has test262 tests normative change Affects behavior required to correctly evaluate some ECMAScript source text web reality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants