This commit is contained in:
Jeremy Ashkenas
2010-09-27 22:52:40 -04:00
11 changed files with 166 additions and 172 deletions

View File

@@ -856,7 +856,7 @@
this.variable = literal(o.scope.freeVariable('ctor'));
}
extension = this.parent && new ExtendsNode(this.variable, this.parent);
props = new Expressions();
props = new Expressions;
o.top = true;
me = null;
className = this.variable.compile(o);
@@ -865,7 +865,7 @@
applied = new ValueNode(this.parent, [new AccessorNode(literal('apply'))]);
constructor = new CodeNode([], new Expressions([new CallNode(applied, [literal('this'), literal('arguments')])]));
} else {
constructor = new CodeNode();
constructor = new CodeNode;
}
_ref2 = this.properties;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
@@ -1041,7 +1041,7 @@
this.params = _arg;
CodeNode.__super__.constructor.call(this);
this.params || (this.params = []);
this.body || (this.body = new Expressions());
this.body || (this.body = (new Expressions));
this.bound = tag === 'boundfunc';
if (this.bound) {
this.context = 'this';
@@ -1111,7 +1111,7 @@
code = this.body.expressions.length ? ("\n" + (this.body.compileWithDeclarations(o)) + "\n") : '';
func = ("function(" + (params.join(', ')) + ") {" + (code) + (code && this.tab) + "}");
if (this.bound) {
return ("" + (utility('bind')) + "(" + (func) + ", " + (this.context) + ")");
return ("(" + (utility('bind')) + "(" + (func) + ", " + (this.context) + "))");
}
return top ? ("(" + (func) + ")") : func;
};
@@ -1291,6 +1291,8 @@
this.flip = !!flip;
if (this.first instanceof ValueNode && this.first.base instanceof ObjectNode) {
this.first = new ParentheticalNode(this.first);
} else if (this.operator === 'new' && this.first instanceof CallNode) {
return this.first.newInstance();
}
this.first.tags.operation = true;
if (this.second) {
@@ -1309,7 +1311,7 @@
};
OpNode.prototype.CHAINABLE = ['<', '>', '>=', '<=', '===', '!=='];
OpNode.prototype.ASSIGNMENT = ['||=', '&&=', '?='];
OpNode.prototype.PREFIX_OPERATORS = ['typeof', 'delete'];
OpNode.prototype.PREFIX_OPERATORS = ['new', 'typeof', 'delete'];
OpNode.prototype["class"] = 'OpNode';
OpNode.prototype.children = ['first', 'second'];
OpNode.prototype.isUnary = function() {