-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[CS1] fix #4260 and #1349: splat error with soak properties or expressions #4643
[CS1] fix #4260 and #1349: splat error with soak properties or expressions #4643
Conversation
e8ae1e9
to
fb21fbe
Compare
See #4644. I’m not sure this bug is severe enough that it’s worth fixing in 1.x. Since the current output throws runtime errors, this bug doesn’t cause any bugs in anyone’s code; it’s just that some syntax that should be allowable just isn’t, until #4644 gets merged in. Or to look at it another way, we add support for this syntax in CoffeeScript 2 😄 |
@GeoffreyBooth // [a?.b...]
slice.call((typeof a !== "undefined" && a !== null ? a.b : [])); I'll take a look. |
@GeoffreyBooth I think this should be fixed now. |
@@ -1812,7 +1812,7 @@ exports.Splat = class Splat extends Base | |||
assigns: (name) -> | |||
@name.assigns name | |||
|
|||
compileToFragments: (o) -> | |||
compileNode: (o) -> | |||
@name.compileToFragments o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this get LEVEL_OP
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case no, since in CS1 splats are not operators, but are instead handled by Arr
and Assign
.
This is a fix for #4260 and #1349 when invalid JS is compiled if
Splat
contains soak accessor (?.
), orif
statement.Before:
After: