1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

self-compiling the existential operator

This commit is contained in:
Jeremy Ashkenas 2010-02-12 14:15:14 -05:00
parent dbcb9df22b
commit 61a7f7a567
2 changed files with 4 additions and 4 deletions

View file

@ -410,7 +410,7 @@
temp = o.scope.free_variable();
parts[parts.length - 1] = '(' + temp + ' = ' + baseline + ')' + this.SOAK + ((baseline = temp + prop.compile(o)));
} else {
parts[parts.length - 1] = this.SOAK + (baseline += prop.compile(o));
parts[parts.length - 1] += (this.SOAK + (baseline += prop.compile(o)));
}
} else {
part = prop.compile(o);
@ -1007,7 +1007,7 @@
__a = [this.first.compile(o), this.second.compile(o)];
first = __a[0];
second = __a[1];
if (this.first.unwrap.match(IDENTIFIER)) {
if (first.match(IDENTIFIER)) {
o.scope.find(first);
}
if (this.operator === '?=') {

View file

@ -286,7 +286,7 @@ ValueNode: exports.ValueNode: inherit Node, {
temp: o.scope.free_variable()
parts[parts.length - 1]: '(' + temp + ' = ' + baseline + ')' + @SOAK + (baseline: temp + prop.compile(o))
else
parts[parts.length - 1]: @SOAK + (baseline += prop.compile(o))
parts[parts.length - 1] += (@SOAK + (baseline += prop.compile(o)))
else
part: prop.compile(o)
baseline += part
@ -781,7 +781,7 @@ OpNode: exports.OpNode: inherit Node, {
compile_assignment: (o) ->
[first, second]: [@first.compile(o), @second.compile(o)]
o.scope.find(first) if @first.unwrap.match(IDENTIFIER)
o.scope.find(first) if first.match(IDENTIFIER)
return first + ' = ' + ExistenceNode.compile_test(o, @first) + ' ? ' + first + ' : ' + second if @operator is '?='
first + ' = ' + first + ' ' + @operator.substr(0, 2) + ' ' + second