fixing up compout assignment for ?=, which was using a sligtly different path.

This commit is contained in:
Jeremy Ashkenas
2010-07-31 00:42:57 -04:00
parent 8b953bbde6
commit d4ac11cd4f
3 changed files with 5 additions and 5 deletions

View File

@@ -1112,7 +1112,7 @@ exports.OpNode = class OpNode extends BaseNode
[first, firstVar] = @first.compileReference o, precompile: yes, assignment: yes
second = @second.compile o
o.scope.find(first) if first.match(IDENTIFIER)
return "#first = #{ ExistenceNode.compileTest(o, @first) } ? #firstVar : #second" if @operator is '?='
return "#first = #{ ExistenceNode.compileTest(o, literal(firstVar)) } ? #firstVar : #second" if @operator is '?='
"#first = #firstVar #{ @operator.substr(0, 2) } #second"
# If this is an existence operator, we delegate to `ExistenceNode.compileTest`