Skip to content

Commit

Permalink
Merge commit 'b1286752b9f6ccfba9c9c9f05b0e3d52aad835c2' into 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Dec 10, 2017
2 parents 7dd20f9 + b128675 commit e80b6a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/coffeescript/nodes.js

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

3 changes: 2 additions & 1 deletion src/nodes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,8 @@ exports.Assign = class Assign extends Base
unless obj instanceof Elision
assigns.push new Assign(obj, val, null, param: @param, subpattern: yes).compileToFragments o, LEVEL_LIST
else
assigns.push idx.compileToFragments o, LEVEL_LIST
# Output `Elision` only if `idx` is `i++`, e.g. expandedIdx.
assigns.push idx.compileToFragments o, LEVEL_LIST if expandedIdx

assigns.push vvar unless top or @subpattern
fragments = @joinFragmentArrays assigns, ', '
Expand Down
4 changes: 2 additions & 2 deletions test/arrays.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ test "array elisions destructuring with splats and expansions", ->
arrayEq [a,b], [2,[5,6,7,8,9]]
[,c,...,,d,,e] = arr
arrayEq [c,d,e], [2,7,9]
[...,e,,,f,,,] = arr
arrayEq [e,f], [4,7]
[...,f,,,g,,,] = arr
arrayEq [f,g], [4,7]

test "array elisions as function parameters", ->
arr = [1,2,3,4,5,6,7,8,9]
Expand Down

0 comments on commit e80b6a9

Please sign in to comment.