Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This release fixes all currently open bugs, dating as far back as 2014, 2012 and 2011. Heartfelt thanks and congratulations to @zdenko!
if
orswitch
statement with an ambiguouselse
, such asif no then if yes then alert 1 else alert 2
, now compiles where theelse
always corresponds to the closest openthen
. Previously the behavior of an ambiguouselse
was unpredictable. If your code has anyif … then
orswitch … then
statements with multiplethen
s (and one or moreelse
s) the compiled output might be different now, unless you had resolved ambiguity via parentheses. We made this change because the previous behavior was inconsistent and basically a bug: depending on what grammar was where, for example if there was an inline function or something that implied a block, theelse
might bind to an earlierthen
rather than a laterthen
. Now anelse
essentially closes a block opened by athen
, similar to closing an open parenthesis. Fix #3921 & #2342: inline function without parentheses used in condition, inline 'else' #4838then
is missing, the error more accurately points out the location of the mistake. Fix #3933: Missingthen
doesn’t trigger nearby error #4862, Fix #4871:else if
no longer output together #4872coffee
command is run in an environment that doesn’t support some ES2015 JavaScript features that the CoffeeScript compiler itself requires. This can happen if CoffeeScript is installed in Node older than version 6. Throw warning for unsupported runtimes, e.g. Node < 6 #4839[open, contents..., close] = tag.split('')
is now output using ES2015 rest syntax. [Change]: Destructuring with non-final spread should still use rest syntax (#4517) #4825get
orset
can be used without parentheses in more cases, including when attached tothis
or@
or?.
; or when the first argument is an implicit object, e.g.@set key: 'val'
. Fix #4836: functions named get or set can be used without parentheses when attached to@
#4837, Fix #4852, @get @set implicit object #4867break
can now be used inside parentheses, e.g.(doSomething(); break) while condition
or(pick(key); break) for key of obj
. Fix #3441: parentheses wrapping expression throw invalid error #4849this
/@
in destructuring, e.g.({@prop = yes, @otherProp = no}) ->
. Fix #4843: bad output when assigning to @prop in destructuring assignment with defaults #4848super
with a parameter attached tothis
when said parameter is in a lower scope, e.g.class Child extends Parent then constructor: -> super(-> @prop)
. Fix #4868: Incorrect ‘Can’t call super with @params’ error #4869for
loop is given a variable to step by, e.g.for x in [1..3] by step
(as opposed toby 0.5
or some other primitive numeric value). Fix #2047: Infinite loop possible whenfor
loop withrange
uses variables #4853end = 3; fn [0..end]
. Fix #4105: Duplicate variablei
defined when evaluatingrange
#4855start(x = 3).then(-> x = 4)
. Fix #4437: variable scope in chained calls #4863do
, e.g.for [1..3] then masked = 10; do -> alert masked
. Fix #1403: Variables inconsistently masked inside ofdo
#4854fn arg1, arg2,
. Fix #3306: trailing comma in a function call in the last line throws a syntax error #4860a[!b in c..]
. Fix #1726: expression in property access causes unexpected results #4851\
) at any point in afor
line. Fix #3909: Backslash to break line is inconsistent in 'for ... of' and 'for ... in' loops #4861http://rawgit.com/GeoffreyBooth/coffeescript/2.2.0/docs/v2/#changelog
@jashkenas @lydell @connec