followup to #717; made new => actually work

This commit is contained in:
satyr
2010-10-12 04:00:57 +09:00
parent 5ed69a5a58
commit f682bf642f
3 changed files with 28 additions and 25 deletions

View File

@@ -1342,22 +1342,24 @@
})();
exports.Op = (function() {
Op = (function() {
function Op(_arg, _arg2, _arg3, flip) {
this.second = _arg3;
this.first = _arg2;
this.operator = _arg;
function Op(op, first, second, flip) {
if (first instanceof Value && first.base instanceof ObjectLiteral) {
first = new Parens(first);
} else if (op === 'new') {
if (first instanceof Call) {
return first.newInstance();
}
if (first instanceof Code && first.bound) {
first = new Parens(first);
}
}
Op.__super__.constructor.call(this);
this.operator = this.CONVERSIONS[this.operator] || this.operator;
this.operator = this.CONVERSIONS[op] || op;
(this.first = first).tags.operation = true;
if (second) {
(this.second = second).tags.operation = true;
}
this.flip = !!flip;
if (this.first instanceof Value && this.first.base instanceof ObjectLiteral) {
this.first = new Parens(this.first);
} else if (this.operator === 'new' && this.first instanceof Call) {
return this.first.newInstance();
}
this.first.tags.operation = true;
if (this.second) {
this.second.tags.operation = true;
}
return this;
};
return Op;