Make power operator compilation use proper AST nodes

This commit is contained in:
Demian Ferreiro
2013-03-25 00:02:21 -03:00
parent e237abff84
commit fbc019171c
2 changed files with 6 additions and 9 deletions

View File

@@ -2348,11 +2348,9 @@
};
Op.prototype.compilePower = function(o) {
var left, parts, right;
left = this.first.compileToFragments(o, LEVEL_OP);
right = this.second.compileToFragments(o, LEVEL_OP);
parts = [this.makeCode('Math.pow('), left, this.makeCode(', '), right, this.makeCode(')')];
return this.joinFragmentArrays(parts, '');
var pow;
pow = new Value(new Literal('Math'), [new Access(new Literal('pow'))]);
return new Call(pow, [this.first, this.second]).compileToFragments(o);
};
Op.prototype.toString = function(idt) {