You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following compiles correctly into JavaScript if I paste it into the "Try CoffeeScript" box on the CoffeeScript homepage:
x = ( key for own key of obj )
(Is that called "object comprehension?" I don't know.) This is a very small and uninteresting example, but I boiled it down to this case from the more interesting example in which I encountered it.
But we get inconsistent variations if I try to break the line at various points. First, let me list those that compile as expected:
x \
= ( key for own key of obj )
x = \
( key for own key of obj )
x = ( \
key for own key of obj )
x = ( key \
for own key of obj )
x = ( key for own key of \
obj )
x = ( key for own key of obj \
)
Now, those that don't compile. All say "Error on line 2: unexpected of." And yet, it's the exact same statement, just with breaks at different points.
x = ( key for \
own key of obj )
x = ( key for own \
key of obj )
x = ( key for own key \
of obj )
This is my first issue for this project, so please forgive me if this idiosyncrasy is known or exists more broadly. I did a brief search of the issues before posting, but certainly may have missed it.
The text was updated successfully, but these errors were encountered:
So, in case one, if we have long argument names, we may make them their own line, but we have to put the first one on like 1, unless we use parenthesis.
You can use the backslash so that you don't need to put arg1 on the same line, but it totally screws up the other 2 args, ( and doesn't care it outdented )
This works and is the way it HAS to be done currently, though ideally, this would be possible without commas.
IMO the 2nd example is a bug, as it doesn't have an outdent error, but if that syntax produced the output of 3, that'd be great.
GeoffreyBooth
changed the title
Backslash to break line is inconsistent in object comprehension
Lexer: Backslash to break line is inconsistent in object comprehension
May 6, 2017
zdenko
added a commit
to zdenko/coffeescript
that referenced
this issue
Jan 19, 2018
The following compiles correctly into JavaScript if I paste it into the "Try CoffeeScript" box on the CoffeeScript homepage:
(Is that called "object comprehension?" I don't know.) This is a very small and uninteresting example, but I boiled it down to this case from the more interesting example in which I encountered it.
But we get inconsistent variations if I try to break the line at various points. First, let me list those that compile as expected:
Now, those that don't compile. All say "Error on line 2: unexpected of." And yet, it's the exact same statement, just with breaks at different points.
This is my first issue for this project, so please forgive me if this idiosyncrasy is known or exists more broadly. I did a brief search of the issues before posting, but certainly may have missed it.
The text was updated successfully, but these errors were encountered: