coco 02ee77c: nodes: fixed parenthesization in Op::compileNode

This commit is contained in:
Jeremy Ashkenas
2010-11-13 18:27:05 -05:00
parent 144b66c4da
commit c7cd72c682
2 changed files with 10 additions and 2 deletions

View File

@@ -1381,6 +1381,7 @@
return ((_ref = this.operator) === '++' || _ref === '--' || _ref === 'delete') && unfoldSoak(o, this, 'first');
};
Op.prototype.compileNode = function(o) {
var code;
if (this.isUnary()) {
return this.compileUnary(o);
}
@@ -1391,7 +1392,12 @@
return this.compileExistence(o);
}
this.first.front = this.front;
return "" + (this.first.compile(o, LEVEL_OP)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP));
code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP);
if (o.level <= LEVEL_OP) {
return code;
} else {
return "(" + code + ")";
}
};
Op.prototype.compileChain = function(o) {
var code, fst, shared, _ref;