mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
(experimental) made new a unary operator
This commit is contained in:
10
lib/nodes.js
10
lib/nodes.js
@@ -868,7 +868,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);
|
||||
@@ -877,7 +877,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++) {
|
||||
@@ -1055,7 +1055,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';
|
||||
@@ -1311,6 +1311,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) {
|
||||
@@ -1329,7 +1331,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() {
|
||||
|
||||
Reference in New Issue
Block a user