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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user