Should throw on invaid `(a = 1) = t`
See original GitHub issueThis 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' }
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
What exceptions should be thrown for invalid or unexpected ...
The trick is to throw the exception that best expresses why the method cannot be called the way it is. Ideally, the exception...
Read more >Creating and Throwing Exceptions | Microsoft Learn
Programmers should throw exceptions when one or more of the following conditions are true: The method can't complete its defined ...
Read more >throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current function will stop (the statements after throw won't be ...
Read more >Should a getter throw an exception if its object has invalid state?
It seems a good idea, doesn't it? I can add a exception-raising code to getCompleteName method. But in this way I'm violating an...
Read more >Throwing ArgumentException and InvalidOperationException
When the exception is raised, it cancels the withdraw transaction and ... and should be thrown when a method argument receives an invalid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is the same as https://github.com/acornjs/acorn/issues/886 which has been fixed by https://github.com/acornjs/acorn/commit/1d5b531b9178aa6c84c346a8d7ed381c17e9a820 and released in Acorn 8.0.0.
We’ll update Acorn dependency in the next Espree major version (#456).
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.