fixed behavioural change accidentally introduced by #1348, thanks @satyr

This commit is contained in:
Michael Ficarra 2011-05-11 00:08:24 -04:00
parent a024ec5b27
commit 6c9ef76b95
3 changed files with 8 additions and 2 deletions

View File

@ -1702,7 +1702,7 @@
if (this.isExistentialEquals) {
return new If(new Existence(fst).invert(), this.second, {
type: 'if'
}).compile(o);
}).addElse(fst).compile(o);
} else {
return new If(new Existence(fst), ref, {
type: 'if'

View File

@ -1317,7 +1317,7 @@ exports.Op = class Op extends Base
fst = @first
ref = fst
if @isExistentialEquals
new If(new Existence(fst).invert(), @second, type: 'if').compile o
new If(new Existence(fst).invert(), @second, type: 'if').addElse(fst).compile o
else
new If(new Existence(fst), ref, type: 'if').addElse(@second).compile o

View File

@ -268,3 +268,9 @@ test "existential assignment", ->
eq nonce, c
d ?= nonce
eq nonce, d
test "#1348, #1216: existential assignment comilation", ->
nonce = {}
a = nonce
b = (a ?= 0)
eq nonce, b