Browse Source

consider EMeta for operator precedence (fixed issue #1427)

Simon Krajewski 12 years ago
parent
commit
4f5bd850bd
2 changed files with 4 additions and 1 deletions
  1. 2 1
      parser.ml
  2. 2 0
      tests/unit/TestOps.hx

+ 2 - 1
parser.ml

@@ -109,7 +109,8 @@ let swap op1 op2 =
 
 let rec make_binop op e ((v,p2) as e2) =
 	match v with
-	| EBinop (_op,_e,_e2) when swap op _op ->
+	| EBinop (_op,_e,_e2)
+	| EMeta(_,(EBinop (_op,_e,_e2),_)) when swap op _op ->
 		let _e = make_binop op e _e in
 		EBinop (_op,_e,_e2) , punion (pos _e) (pos _e2)
 	| ETernary (e1,e2,e3) when is_not_assign op ->

+ 2 - 0
tests/unit/TestOps.hx

@@ -93,6 +93,8 @@ class TestOps extends Test {
 		eq( -x--, -2);
 		
 		eq( ("bla" + "x").indexOf("x"), 3);
+		
+		eq(5 * @foo 3 + 4, 19);
 	}
 
 }