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

Should throw on invaid (a = 1) = t #470

Closed
fisker opened this issue Feb 26, 2021 · 6 comments · Fixed by #473
Closed

Should throw on invaid (a = 1) = t #470

fisker opened this issue Feb 26, 2021 · 6 comments · Fixed by #473

Comments

@fisker
Copy link
Contributor

fisker commented Feb 26, 2021

This should be invalid.

require("espree").parse('(a = 1) = 2', {sourceType: 'module', ecmaVersion: 2019}).body[0].expression
Node {
  type: 'AssignmentExpression',
  start: 0,
  end: 11,
  operator: '=',
  left: Node {
    type: 'AssignmentPattern',
    start: 1,
    end: 6,
    left: Node { type: 'Identifier', start: 1, end: 2, name: 'a' },
    right: Node { type: 'Literal', start: 5, end: 6, value: 1, raw: '1' }
  },
  right: Node { type: 'Literal', start: 10, end: 11, value: 2, raw: '2' }
}
@fisker

This comment has been minimized.

@fisker fisker closed this as completed Feb 26, 2021
@fisker fisker changed the title Should throw on invaid (a = 1) = 2 Should throw on invaid (a = 1) = t Feb 26, 2021
@fisker fisker reopened this Feb 26, 2021
@aladdin-add
Copy link
Member

is it happening in acorn.js ?

@fisker
Copy link
Contributor Author

fisker commented Feb 26, 2021

As I tested, yes, it happens in acorn too. I'll open a issue there.

@fisker
Copy link
Contributor Author

fisker commented Feb 26, 2021

acornjs/acorn#1017, should I close this?

@aladdin-add
Copy link
Member

aladdin-add commented Feb 26, 2021

as it's also a bug in espree, I suggest to keep it open to track it.

we can close it when the issue was fixed in acorn, and espree update its dependency acorn.

@mdjermanovic
Copy link
Member

I think this is the same as acornjs/acorn#886 which has been fixed by acornjs/acorn@1d5b531 and released in Acorn 8.0.0.

We'll update Acorn dependency in the next Espree major version (#456).

aladdin-add added a commit that referenced this issue Apr 9, 2021
nzakas pushed a commit that referenced this issue Apr 16, 2021
* Breaking: acorn to 8.1.0

changelog:
https://github.com/acornjs/acorn/blob/master/acorn/CHANGELOG.md#breaking-changes

fixes #470, #472

* Update tests/lib/parse.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* fix: add ecmaversion>5

* fix: remove #472 test case

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants