(experimental) made new a unary operator

This commit is contained in:
satyr
2010-09-25 17:39:19 +09:00
parent 9a3b736174
commit c24e1eacb9
10 changed files with 32 additions and 42 deletions

View File

@@ -1121,7 +1121,7 @@ exports.OpNode = class OpNode extends BaseNode
ASSIGNMENT: ['||=', '&&=', '?=']
# Operators must come before their operands with a space.
PREFIX_OPERATORS: ['typeof', 'delete']
PREFIX_OPERATORS: ['new', 'typeof', 'delete']
class: 'OpNode'
children: ['first', 'second']
@@ -1132,6 +1132,8 @@ exports.OpNode = class OpNode extends BaseNode
@flip = !!flip
if @first instanceof ValueNode and @first.base instanceof ObjectNode
@first = new ParentheticalNode @first
else if @operator is 'new' and @first instanceof CallNode
return @first.newInstance()
@first.tags.operation = yes
@second.tags.operation = yes if @second