-
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
Lexer: Chaining: Leading dot not working with do
#3736
Comments
@xixixao Can you say something about this? |
Temporary may use lodash/underscore _.identity do ->
"foo qwe"
.replace "qwe", "bar" |
@Darrrk This was probably never supported. (do ->
"foo qwe"
).replace "qwe", "bar" PR welcome. |
Or if you really don't want to parenthesise the multi-line function, ((x)->x()) ()->
"foo qwe"
.replace "qwe", "bar" |
Seriously, if this isn't going to be fixed, and there is an easy, clear, and obvious way out (the parens around the do) then why is this issue even open? |
@michaelficarra You are just inlining the library call, which is arguably worse than the original. @ChristopherDumas It would presumably be nice to fix this if it's not too difficult. It's open because none of the moderators are obliged (or paid) to close or comment on an issue within some fixed amount of time. Let's help them by not adding spurious comments. |
CoffeeScript beautiful, because generally I can ignore parens. (function() {
return "foo qwe";
})(); Therefore, it's chainable too. |
do
do
This was fixed, in the sense that it compiles now, via #4665; but the new output isn’t what you want: do ->
"foo qwe"
.replace "qwe", "bar" (function() {
return "foo qwe";
}).replace("qwe", "bar")(); Note that the do foo
.bar
# foo.bar() I’m not sure if anyone uses do foo.bar
# foo.bar() So having (do ->
"foo qwe"
).replace "qwe", "bar" |
@GeoffreyBooth I think the current compilation (as of #4665) is quite unintuitive/unexpected. And this chained |
Yeah I was reconsidering this today, I think you're right. |
* add parens to chained do iife [Fixes #3736] * remove debug code * fixes from code review
* add parens to chained do iife [Fixes #3736] * remove debug code * fixes from code review * handle iife with params * add test w/ destructured param from code review
The text was updated successfully, but these errors were encountered: