Skip to content

Commit

Permalink
Fixes jashkenas#2155 -- existential assignment to a closure
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Mar 1, 2012
1 parent 1c8411f commit b9cfb5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/coffee-script/nodes.js

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

1 change: 1 addition & 0 deletions src/nodes.coffee
Expand Up @@ -1171,6 +1171,7 @@ exports.Code = class Code extends Base
o.scope.shared = del(o, 'sharedScope')
o.indent += TAB
delete o.bare
delete o.isExistentialEquals
params = []
exprs = []
for name in @paramNames() # this step must be performed before the others
Expand Down
6 changes: 6 additions & 0 deletions test/operators.coffee
Expand Up @@ -269,3 +269,9 @@ test "Regression with implicit calls against an indented assignment", ->
1

eq a, 1

test "#2155 ... conditional assignment to a closure", ->
x = null
func = -> x ?= (-> if true then 'hi')
func()
eq x(), 'hi'

0 comments on commit b9cfb5a

Please sign in to comment.