Skip to content

2.2.3 #5010

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

Merged
merged 3 commits into from
Mar 11, 2018
Merged

2.2.3 #5010

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/v2/annotated-source/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3215,7 +3215,9 @@ <h3 id="obj">Obj</h3>
<div class="content"><div class='highlight'><pre> message = isUnassignable prop.unwrapAll().value
prop.error message <span class="hljs-keyword">if</span> message

prop = prop.value <span class="hljs-keyword">if</span> prop <span class="hljs-keyword">instanceof</span> Assign <span class="hljs-keyword">and</span> prop.context <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>
prop = prop.value <span class="hljs-keyword">if</span> prop <span class="hljs-keyword">instanceof</span> Assign <span class="hljs-keyword">and</span>
prop.context <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span> <span class="hljs-keyword">and</span>
prop.value?.base <span class="hljs-keyword">not</span> <span class="hljs-keyword">instanceof</span> Arr
<span class="hljs-keyword">return</span> <span class="hljs-literal">no</span> <span class="hljs-keyword">unless</span> prop.isAssignable()
<span class="hljs-literal">yes</span>

Expand Down Expand Up @@ -4933,7 +4935,8 @@ <h3 id="assign">Assign</h3>
vvarText = ref
<span class="hljs-function">
<span class="hljs-title">slicer</span> = <span class="hljs-params">(type)</span> -&gt;</span> (vvar, start, end = <span class="hljs-literal">no</span>) -&gt;
args = [<span class="hljs-keyword">new</span> IdentifierLiteral(vvar), <span class="hljs-keyword">new</span> NumberLiteral(start)]
vvar = <span class="hljs-keyword">new</span> IdentifierLiteral vvar <span class="hljs-keyword">unless</span> vvar <span class="hljs-keyword">instanceof</span> Value
args = [vvar, <span class="hljs-keyword">new</span> NumberLiteral(start)]
args.push <span class="hljs-keyword">new</span> NumberLiteral end <span class="hljs-keyword">if</span> end
slice = <span class="hljs-keyword">new</span> Value (<span class="hljs-keyword">new</span> IdentifierLiteral utility type, o), [<span class="hljs-keyword">new</span> Access <span class="hljs-keyword">new</span> PropertyName <span class="hljs-string">'call'</span>]
<span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Call slice, args</pre></div></div>
Expand Down Expand Up @@ -5184,7 +5187,7 @@ <h3 id="assign">Assign</h3>
</div>

<div class="content"><div class='highlight'><pre> refExp = <span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> isSplat <span class="hljs-keyword">then</span> compSplice objects[expIdx].unwrapAll().value, rightObjs.length * <span class="hljs-number">-1</span>
<span class="hljs-keyword">when</span> isSplat <span class="hljs-keyword">then</span> compSplice <span class="hljs-keyword">new</span> Value(objects[expIdx].name), rightObjs.length * <span class="hljs-number">-1</span>
<span class="hljs-keyword">when</span> isExpans <span class="hljs-keyword">then</span> compSlice vvarText, rightObjs.length * <span class="hljs-number">-1</span>
<span class="hljs-keyword">if</span> complexObjects rightObjs
restVar = refExp
Expand Down
4 changes: 2 additions & 2 deletions docs/v2/browser-compiler/coffeescript.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions docs/v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
<section id="overview">
<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>
<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>
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.2.2">2.2.2</a></p>
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.2.3">2.2.3</a></p>
<blockquote class="uneditable-code-block"><pre><code class="language-bash"><span class="comment"># Install locally for a project:</span>
npm install --save-dev coffeescript

Expand Down Expand Up @@ -4790,7 +4790,7 @@ <h2>Web Chat (IRC)</h2>
</section>
<section id="annotated-source">
<h2>Annotated Source</h2>
<p>You can browse the CoffeeScript 2.2.2 source in readable, annotated form <a href="annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
<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>
<ul>
<li><a href="annotated-source/grammar.html">Grammar Rules — src/grammar</a></li>
<li><a href="annotated-source/lexer.html">Lexing Tokens — src/lexer</a></li>
Expand Down Expand Up @@ -5467,6 +5467,14 @@ <h3>Argument parsing and shebang (<code>#!</code>) lines</h3>
</section>
<section id="changelog">
<h2>Changelog</h2>
<div class="anchor" id="2.2.3"></div>
<h2 class="header">
<a href="https://github.com/jashkenas/coffeescript/compare/2.1.2...2.2.3">2.2.3</a>
<span class="timestamp"> &mdash; <time datetime="2018-03-11">March 11, 2018</time></span>
</h2><ul>
<li>Bugfix for object destructuring with an empty array as a key’s value: <code>{ key: [] } = obj</code>.</li>
<li>Bugfix for array destructuring onto targets attached to <code>this</code>: <code>[ @most... , @penultimate, @last ] = arr</code>.</li>
</ul>
<div class="anchor" id="2.2.2"></div>
<h2 class="header">
<a href="https://github.com/jashkenas/coffeescript/compare/2.1.1...2.2.2">2.2.2</a>
Expand Down
51 changes: 49 additions & 2 deletions docs/v2/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ <h1>CoffeeScript Test Suite</h1>
([first, ...] = list); first

f4 = (list) ->
([first, ...rest] = list); rest
([first, rest...] = list); rest

arrayEq f1(arr), arr
arrayEq f2(arr), arr
Expand All @@ -1606,13 +1606,60 @@ <h1>CoffeeScript Test Suite</h1>
bar = (list) ->
ret =
if list?.length > 0
[first, ...rest] = list
[first, rest...] = list
[first, rest]
else
[]

arrayEq bar(arr), ['a', ['b', 'c', 'd']]

test "destructuring assignment with an empty array in object", ->
obj =
a1: [1, 2]
b1: 3

{a1:[], b1} = obj
eq 'undefined', typeof a1
eq b1, 3

obj =
a2:
b2: [1, 2]
c2: 3

{a2: {b2:[]}, c2} = obj
eq 'undefined', typeof b2
eq c2, 3

test "#5004: array destructuring with accessors", ->
obj =
arr: ['a', 'b', 'c', 'd']
list: {}
f1: ->
[@first, @rest...] = @arr
f2: ->
[@second, @third..., @last] = @rest
f3: ->
[@list.a, @list.middle..., @list.d] = @arr

obj.f1()
eq obj.first, 'a'
arrayEq obj.rest, ['b', 'c', 'd']

obj.f2()
eq obj.second, 'b'
arrayEq obj.third, ['c']
eq obj.last, 'd'

obj.f3()
eq obj.list.a, 'a'
arrayEq obj.list.middle, ['b', 'c']
eq obj.list.d, 'd'

[obj.list.middle..., d] = obj.arr
eq d, 'd'
arrayEq obj.list.middle, ['a', 'b', 'c']

</script>
<script type="text/x-coffeescript" class="test" id="async">
# Functions that contain the `await` keyword will compile into async functions,
Expand Down
6 changes: 6 additions & 0 deletions documentation/sections/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

```
releaseHeader('2018-03-11', '2.2.3', '2.1.2')
```
* Bugfix for object destructuring with an empty array as a key’s value: `{ key: [] } = obj`.
* Bugfix for array destructuring onto targets attached to `this`: `[ @most... , @penultimate, @last ] = arr`.

```
releaseHeader('2018-02-21', '2.2.2', '2.1.1')
```
Expand Down
2 changes: 1 addition & 1 deletion lib/coffeescript/browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/cake.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/coffeescript.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/grammar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/lexer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/optparse.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/register.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/repl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/rewriter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/scope.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffeescript/sourcemap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading