coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

Shorthand broken (x[index] or =[]).push(item) in 1.11.0

Open jjog1 opened this issue 10 years ago • 5 comments

In 1.11.0 the follow shorthand has been broken.

(result[groupByIndex] or =[]).push(item)

Previously this would have compiled to

(result[groupByIndex] || (result[groupByIndex] = [])).push(item);

Now it throws a compilation error. Its not a major issue and a quick fix on our side but I wanted to bring it up to make sure you were aware of it.

jjog1 avatar Sep 26 '16 09:09 jjog1

You mean spacing or = instead of writing or=?

vendethiel avatar Sep 26 '16 09:09 vendethiel

Just or =[] it worked previously, now its throwing ParseError: unexpected =

jjog1 avatar Sep 26 '16 09:09 jjog1

Seems like that was changed on purpose in #4221 (you just need to globally find-and-replace "or =" with "or=" and your code will work again).

@lydell That might want to be documented

vendethiel avatar Sep 26 '16 09:09 vendethiel

@vendethiel you're right. Thats fixed it thank you! 👍

jjog1 avatar Sep 26 '16 09:09 jjog1

Reopening until added to the changelog :)

vendethiel avatar Sep 26 '16 09:09 vendethiel