Skip to content

Commit

Permalink
support arbitrary patterns for ForIn value patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Jun 1, 2015
1 parent 69966f0 commit d47df16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/compiler.js

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

10 changes: 5 additions & 5 deletions src/compiler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,11 @@ class exports.Compiler
else if (step instanceof JS.Literal) and step.value == 1
target

if es6Target
if valAssignee and keyAssignee
return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator new JS.ArrayPattern([keyAssignee, valAssignee])]), new JS.CallExpression((memberAccess es6Target, 'entries'), []), forceBlock body)
else if valAssignee
return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator valAssignee]), es6Target, forceBlock body)
if es6Target and valAssignee and (valPattern = es6AssignmentPattern(valAssignee))
if keyAssignee
return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator new JS.ArrayPattern([keyAssignee, valPattern])]), new JS.CallExpression((memberAccess es6Target, 'entries'), []), forceBlock body)
else
return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator valPattern]), es6Target, forceBlock body)


i = genSym 'i'
Expand Down

0 comments on commit d47df16

Please sign in to comment.