fixed unop issues
This commit is contained in:
@@ -65,6 +65,9 @@ class Test {
|
||||
test("var t = 0; for( x in new IntIter(1,10) ) t +=x; t",45,{ IntIter : IntIter });
|
||||
test("var x = 1; try { var x = 66; throw 789; } catch( e : Dynamic ) e + x",790);
|
||||
test("var x = 1; var f = function(x) throw x; try f(55) catch( e : Dynamic ) e + x",56);
|
||||
test("var i=2; if( true ) --i; i",1);
|
||||
test("var i=0; if( i++ > 0 ) i=3; i",1);
|
||||
test("var a = 5/2; a",2.5);
|
||||
trace("Done");
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -335,8 +335,13 @@ class Parser {
|
||||
switch( tk ) {
|
||||
case TOp(op):
|
||||
for( x in unopsSuffix )
|
||||
if( x == op )
|
||||
return EUnop(op,false,e1);
|
||||
if( x == op ) {
|
||||
if( isBlock(e1) || switch(e1) { case EParent(_): true; default: false; } ) {
|
||||
tokens.add(tk);
|
||||
return e1;
|
||||
}
|
||||
return parseExprNext(s,EUnop(op,false,e1));
|
||||
}
|
||||
return makeBinop(op,e1,parseExpr(s));
|
||||
case TDot:
|
||||
tk = token(s);
|
||||
@@ -579,6 +584,7 @@ class Parser {
|
||||
}
|
||||
return token(s);
|
||||
}
|
||||
this.char = char;
|
||||
return TOp(op);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user