Skip to content
Browse files

add prefix property to UnaryExpressions

  • Loading branch information...
1 parent a129fcf commit c2ccb48decb438a3dc53ce83149b93b453974f05 @zaach zaach committed
Showing with 9 additions and 8 deletions.
  1. +7 −7 lib/grammar.y
  2. +2 −1 lib/nodes.js
View
14 lib/grammar.y
@@ -308,23 +308,23 @@ PostfixExprNoBF
UnaryExprCommon
: DELETETOKEN UnaryExpr
- { $$ = yy.Node('UnaryExpression','delete',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','delete',$2,true,yy.loc([@$,@2])); }
| VOIDTOKEN UnaryExpr
- { $$ = yy.Node('UnaryExpression','void',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','void',$2,true,yy.loc([@$,@2])); }
| TYPEOF UnaryExpr
- { $$ = yy.Node('UnaryExpression','typeof',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','typeof',$2,true,yy.loc([@$,@2])); }
| PLUSPLUS UnaryExpr
{ $$ = yy.Node('UpdateExpression','++',$2,true,yy.loc([@$,@2])); }
| MINUSMINUS UnaryExpr
{ $$ = yy.Node('UpdateExpression','--',$2,true,yy.loc([@$,@2])); }
| '+' UnaryExpr
- { $$ = yy.Node('UnaryExpression','+',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','+',$2,true,yy.loc([@$,@2])); }
| '-' UnaryExpr
- { $$ = yy.Node('UnaryExpression','-',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','-',$2,true,yy.loc([@$,@2])); }
| '~' UnaryExpr
- { $$ = yy.Node('UnaryExpression','~',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','~',$2,true,yy.loc([@$,@2])); }
| '!' UnaryExpr
- { $$ = yy.Node('UnaryExpression','!',$2,yy.loc([@$,@2])); }
+ { $$ = yy.Node('UnaryExpression','!',$2,true,yy.loc([@$,@2])); }
;
UnaryExpr
View
3 lib/nodes.js
@@ -207,9 +207,10 @@ def('LogicalExpression', function (op, left, right, loc) {
this.loc = loc;
});
-def('UnaryExpression', function (operator, argument, loc) {
+def('UnaryExpression', function (operator, argument, prefix, loc) {
this.operator = operator;
this.argument = argument;
+ this.prefix = prefix;
this.loc = loc;
});

0 comments on commit c2ccb48

Please sign in to comment.
Something went wrong with that request. Please try again.