mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fixes #2155 -- existential assignment to a closure
This commit is contained in:
@@ -1566,6 +1566,7 @@
|
||||
o.scope.shared = del(o, 'sharedScope');
|
||||
o.indent += TAB;
|
||||
delete o.bare;
|
||||
delete o.isExistentialEquals;
|
||||
params = [];
|
||||
exprs = [];
|
||||
_ref3 = this.paramNames();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
Reference in New Issue
Block a user