Browse Source

really consider EMeta for operator precendence (fixed issue #1427)

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

+ 3 - 2
parser.ml

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

+ 1 - 0
tests/unit/TestOps.hx

@@ -95,6 +95,7 @@ class TestOps extends Test {
 		eq( ("bla" + "x").indexOf("x"), 3);
 		
 		eq(5 * @foo 3 + 4, 19);
+		eq(5 * @foo @bar 3 + @baz 4, 19);
 	}
 
 }