-
Notifications
You must be signed in to change notification settings - Fork 2k
[a >>>= b] = c #1325
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
Comments
seems like this bug (?) works for [a ???= b] = c for any arithmetic ??? (or nothing). |
@Adam-F: Yeah, arbitrary expressions (like assignment and compound assignment) should not be allowed on the left side of destructuring assignment, only identifiers and other destructuring constructs. |
In CS2 this compiles to: var a;
[a >>>= b] = c; Which is invalid JavaScript, but probably not worth our time for the compiler to catch as opposed to the runtime. |
The compiler should not emit invalid JavaScript. |
That’s not quite true. The compiler should not emit invalid JavaScript for valid CoffeeScript, but we’re not trying to catch all potentially catchable errors at compile time. We don’t validate potentially invalid regular expressions, for example: new RegExp("(?<=\\s)(?<!\\:\\s)#.*?\\{.*?\\}","gm"); That compiles to JavaScript, and the runtime throws See this comment. It’s not worth the added complexity and performance hit for the compiler to catch all possible edge cases, especially ones that will be caught by the runtime anyway. |
Unicode and regex are completely different beasts. This case is perfectly possible to fix with way less complexity. I’m fine if you close this with your go-to “This doesn’t affect many people. PRs welcome”, but not with your previous comment. |
Okay. If someone would like to fix this, please be our guest. |
The text was updated successfully, but these errors were encountered: