mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fixes #2155 -- existential assignment to a closure
This commit is contained in:
parent
1c8411f628
commit
b9cfb5a7d8
3 changed files with 8 additions and 0 deletions
|
@ -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'
|
Loading…
Add table
Reference in a new issue