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

Rationale behind early ReferenceError and early SyntaxError #1267

Closed
Constellation opened this Issue Jul 19, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Constellation

Constellation commented Jul 19, 2018

I'm attempting to update JSC's parser to accept early ReferenceError concept.
But I don't get the point of the rationale behind early ReferenceError and SyntaxError yet.

According to the spec[1,2],

function test() {
    "use strict";
    arguments = 42;
}

should raise early ReferenceError. On the other hand,

function test() {
    "use strict";
    ({ arguments } = object);
}
function test() {
    "use strict";
    ({ a: arguments = 20 } = object);
}

should raise early SyntaxError[3].

What makes this differences? Why are IdentifierReference in Object/ArrayPatterns handled differently from usual AssignmentExpression LHS's IdentifierReference?
This is a bit confusing and it seems that even test262 does not test it correctly (see test/language/expressions/assignment/id-arguments-strict.js for example).

1: https://tc39.github.io/ecma262/#sec-assignment-operators-static-semantics-early-errors
2: https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-isvalidsimpleassignmenttarget
3: https://tc39.github.io/ecma262/#sec-destructuring-assignment-static-semantics-early-errors

@IgnoredAmbience

This comment has been minimized.

Show comment
Hide comment
@IgnoredAmbience

IgnoredAmbience Jul 19, 2018

Member

It looks like this was previously raised as a bug in the ES6 spec period and got deferred to ES7, but never resolved?
https://tc39.github.io/archives/bugzilla/4375/

Member

IgnoredAmbience commented Jul 19, 2018

It looks like this was previously raised as a bug in the ES6 spec period and got deferred to ES7, but never resolved?
https://tc39.github.io/archives/bugzilla/4375/

@IgnoredAmbience

This comment has been minimized.

Show comment
Hide comment
@IgnoredAmbience

IgnoredAmbience Jul 19, 2018

Member

PR #1132 is open already to fix this as well.

Member

IgnoredAmbience commented Jul 19, 2018

PR #1132 is open already to fix this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment