Skip to content

Commit e5aa758

Browse files
2.2.4 (#5025)
* Update changelog for 2.2.4 * Bump version to 2.2.4; update output
1 parent 001f97a commit e5aa758

File tree

21 files changed

+588
-582
lines changed

21 files changed

+588
-582
lines changed

docs/v2/annotated-source/nodes.html

Lines changed: 506 additions & 521 deletions
Large diffs are not rendered by default.

docs/v2/browser-compiler/coffeescript.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v2/index.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@
646646
<section id="overview">
647647
<p><strong>CoffeeScript is a little language that compiles into JavaScript.</strong> Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.</p>
648648
<p>The golden rule of CoffeeScript is: <em>“It’s just JavaScript.”</em> The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript.</p>
649-
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.2.3">2.2.3</a></p>
649+
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.2.4">2.2.4</a></p>
650650
<blockquote class="uneditable-code-block"><pre><code class="language-bash"><span class="comment"># Install locally for a project:</span>
651651
npm install --save-dev coffeescript
652652

@@ -4790,7 +4790,7 @@ <h2>Web Chat (IRC)</h2>
47904790
</section>
47914791
<section id="annotated-source">
47924792
<h2>Annotated Source</h2>
4793-
<p>You can browse the CoffeeScript 2.2.3 source in readable, annotated form <a href="annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
4793+
<p>You can browse the CoffeeScript 2.2.4 source in readable, annotated form <a href="annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
47944794
<ul>
47954795
<li><a href="annotated-source/grammar.html">Grammar Rules — src/grammar</a></li>
47964796
<li><a href="annotated-source/lexer.html">Lexing Tokens — src/lexer</a></li>
@@ -5467,25 +5467,33 @@ <h3>Argument parsing and shebang (<code>#!</code>) lines</h3>
54675467
</section>
54685468
<section id="changelog">
54695469
<h2>Changelog</h2>
5470+
<div class="anchor" id="2.2.4"></div>
5471+
<h2 class="header">
5472+
<a href="https://github.com/jashkenas/coffeescript/compare/2.2.3...2.2.4">2.2.4</a>
5473+
<span class="timestamp"> &mdash; <time datetime="2018-03-29">March 29, 2018</time></span>
5474+
</h2><ul>
5475+
<li>When the <code>by</code> value in a <code>for</code> loop is a literal number, e.g. <code>for x in [2..1] by -1</code>, fewer checks are necessary to determine if the loop is in range.</li>
5476+
<li>Bugfix for regression in 2.2.0 where a statement inside parentheses, e.g. <code>(fn(); break) while condition</code>, was compiling. Pure statements like <code>break</code> or <code>return</code> cannot turn a parenthesized block into an expression, and should throw an error.</li>
5477+
</ul>
54705478
<div class="anchor" id="2.2.3"></div>
54715479
<h2 class="header">
5472-
<a href="https://github.com/jashkenas/coffeescript/compare/2.1.2...2.2.3">2.2.3</a>
5480+
<a href="https://github.com/jashkenas/coffeescript/compare/2.2.2...2.2.3">2.2.3</a>
54735481
<span class="timestamp"> &mdash; <time datetime="2018-03-11">March 11, 2018</time></span>
54745482
</h2><ul>
54755483
<li>Bugfix for object destructuring with an empty array as a key’s value: <code>{ key: [] } = obj</code>.</li>
54765484
<li>Bugfix for array destructuring onto targets attached to <code>this</code>: <code>[ @most... , @penultimate, @last ] = arr</code>.</li>
54775485
</ul>
54785486
<div class="anchor" id="2.2.2"></div>
54795487
<h2 class="header">
5480-
<a href="https://github.com/jashkenas/coffeescript/compare/2.1.1...2.2.2">2.2.2</a>
5488+
<a href="https://github.com/jashkenas/coffeescript/compare/2.2.1...2.2.2">2.2.2</a>
54815489
<span class="timestamp"> &mdash; <time datetime="2018-02-21">February 21, 2018</time></span>
54825490
</h2><ul>
54835491
<li>Bugfix for regression in 2.2.0 where a range with a <code>by</code> (step) value that increments or decrements in the opposite direction as the range was returning an array containing the first value of the range, whereas it should be returning an empty array. In other words, <code>x for x in [2..1] by 1</code> should equal <code>[]</code>, not <code>[2]</code> (because the step value is positive 1, counting up, whereas the range goes from 2 to 1, counting down).</li>
54845492
<li>Bugfixes for allowing backslashes in <code>import</code> and <code>export</code> statements and lines that trigger the start of an indented block, like an <code>if</code> statement.</li>
54855493
</ul>
54865494
<div class="anchor" id="2.2.1"></div>
54875495
<h2 class="header">
5488-
<a href="https://github.com/jashkenas/coffeescript/compare/2.1.0...2.2.1">2.2.1</a>
5496+
<a href="https://github.com/jashkenas/coffeescript/compare/2.2.0...2.2.1">2.2.1</a>
54895497
<span class="timestamp"> &mdash; <time datetime="2018-02-06">February 6, 2018</time></span>
54905498
</h2><ul>
54915499
<li>Bugfix for regression in 2.2.0 involving an error thrown by the compiler in certain cases when using destructuring with a splat or expansion in an array.</li>

docs/v2/test.html

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,9 +1664,10 @@ <h1>CoffeeScript Test Suite</h1>
16641664
<script type="text/x-coffeescript" class="test" id="async">
16651665
# Functions that contain the `await` keyword will compile into async functions,
16661666
# supported by Node 7.6+, Chrome 55+, Firefox 52+, Safari 10.1+ and Edge.
1667-
# But runtimes that don’t support the `await` keyword will throw an error,
1668-
# even if we put `return unless global.supportsAsync` at the top of this file.
1669-
# Therefore we need to prevent runtimes which will choke on such code from even
1667+
# But runtimes that don’t support the `await` keyword will throw an error just
1668+
# from parsing this file, even without executing it, even if we put
1669+
# `return unless try new Function 'async () => {}'` at the top of this file.
1670+
# Therefore we need to prevent runtimes which will choke on such code from
16701671
# parsing it, which is handled in `Cakefile`.
16711672

16721673

@@ -2154,6 +2155,7 @@ <h1>CoffeeScript Test Suite</h1>
21542155
inner = ++counter
21552156
->
21562157
@value = inner
2158+
@
21572159

21582160
class One
21592161
constructor: classMaker()
@@ -6808,37 +6810,6 @@ <h1>CoffeeScript Test Suite</h1>
68086810
else "none"
68096811
eq "five", c
68106812

6811-
# Issue #3441: Parentheses wrapping expression throw invalid error in `then` clause
6812-
test "#3441: `StatementLiteral` in parentheses", ->
6813-
i = 0
6814-
r1 = ((i++; break) while i < 10)
6815-
arrayEq r1, []
6816-
6817-
i = 0
6818-
r2 = ((i++; continue) while i < 10)
6819-
arrayEq r2, []
6820-
6821-
i = 0
6822-
r4 = while i < 10 then (i++; break)
6823-
arrayEq r4, []
6824-
6825-
i = 0
6826-
r5 = while i < 10 then (i++; continue)
6827-
arrayEq r5, []
6828-
6829-
arr = [0..9]
6830-
r6 = ((a; break) for a in arr)
6831-
arrayEq r6, []
6832-
6833-
r7 = ((a; continue) for a in arr)
6834-
arrayEq r7, []
6835-
6836-
r8 = for a in arr then (a; break)
6837-
arrayEq r8, []
6838-
6839-
r9 = for a in arr then (a; continue)
6840-
arrayEq r9, []
6841-
68426813
# Issue #3909: backslash to break line in `for` loops throw syntax error
68436814
test "#3909: backslash `for own ... of`", ->
68446815

@@ -8794,6 +8765,42 @@ <h2>Another heading</h2>
87948765
^^^^^^^^^^^^
87958766
'''
87968767

8768+
test "#5013: `await return` as an expression", ->
8769+
assertErrorFormat '''
8770+
-> (await return)
8771+
''', '''
8772+
[stdin]:1:5: error: cannot use a pure statement in an expression
8773+
-> (await return)
8774+
^^^^^^^^^^^^
8775+
'''
8776+
8777+
test "#5013: `return` as an expression", ->
8778+
assertErrorFormat '''
8779+
-> (return)
8780+
''', '''
8781+
[stdin]:1:5: error: cannot use a pure statement in an expression
8782+
-> (return)
8783+
^^^^^^
8784+
'''
8785+
8786+
test "#5013: `break` as an expression", ->
8787+
assertErrorFormat '''
8788+
(b = 1; break) for b in a
8789+
''', '''
8790+
[stdin]:1:9: error: cannot use a pure statement in an expression
8791+
(b = 1; break) for b in a
8792+
^^^^^
8793+
'''
8794+
8795+
test "#5013: `continue` as an expression", ->
8796+
assertErrorFormat '''
8797+
(b = 1; continue) for b in a
8798+
''', '''
8799+
[stdin]:1:9: error: cannot use a pure statement in an expression
8800+
(b = 1; continue) for b in a
8801+
^^^^^^^^
8802+
'''
8803+
87978804
test "`&&=` and `||=` with a space in-between", ->
87988805
assertErrorFormat '''
87998806
a = 0
@@ -16886,7 +16893,7 @@ <h2>Another heading</h2>
1688616893
eq 'undefined', output.lastWrite()
1688716894

1688816895
testRepl "#4604: wraps an async function", (input, output) ->
16889-
return unless global.supportsAsync
16896+
return unless try new Function 'async () => {}' # Feature detect support for async functions.
1689016897
input.emitLine 'await new Promise (resolve) -> setTimeout (-> resolve 33), 10'
1689116898
setTimeout ->
1689216899
eq '33', output.lastWrite()

documentation/sections/changelog.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
## Changelog
22

33
```
4-
releaseHeader('2018-03-11', '2.2.3', '2.1.2')
4+
releaseHeader('2018-03-29', '2.2.4', '2.2.3')
5+
```
6+
* When the `by` value in a `for` loop is a literal number, e.g. `for x in [2..1] by -1`, fewer checks are necessary to determine if the loop is in range.
7+
* Bugfix for regression in 2.2.0 where a statement inside parentheses, e.g. `(fn(); break) while condition`, was compiling. Pure statements like `break` or `return` cannot turn a parenthesized block into an expression, and should throw an error.
8+
9+
```
10+
releaseHeader('2018-03-11', '2.2.3', '2.2.2')
511
```
612
* Bugfix for object destructuring with an empty array as a key’s value: `{ key: [] } = obj`.
713
* Bugfix for array destructuring onto targets attached to `this`: `[ @most... , @penultimate, @last ] = arr`.
814

915
```
10-
releaseHeader('2018-02-21', '2.2.2', '2.1.1')
16+
releaseHeader('2018-02-21', '2.2.2', '2.2.1')
1117
```
1218
* Bugfix for regression in 2.2.0 where a range with a `by` (step) value that increments or decrements in the opposite direction as the range was returning an array containing the first value of the range, whereas it should be returning an empty array. In other words, `x for x in [2..1] by 1` should equal `[]`, not `[2]` (because the step value is positive 1, counting up, whereas the range goes from 2 to 1, counting down).
1319
* Bugfixes for allowing backslashes in `import` and `export` statements and lines that trigger the start of an indented block, like an `if` statement.
1420

1521
```
16-
releaseHeader('2018-02-06', '2.2.1', '2.1.0')
22+
releaseHeader('2018-02-06', '2.2.1', '2.2.0')
1723
```
1824
* Bugfix for regression in 2.2.0 involving an error thrown by the compiler in certain cases when using destructuring with a splat or expansion in an array.
1925
* Bugfix for regression in 2.2.0 where in certain cases a range iterator variable was declared in the global scope.

lib/coffeescript/browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript/cake.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript/coffeescript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript/command.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript/grammar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)