Browse Source

screw this - never change position of a format segment itself

Dan Korostelev 8 years ago
parent
commit
ef95236a34
2 changed files with 7 additions and 4 deletions
  1. 1 1
      src/syntax/ast.ml
  2. 6 3
      std/haxe/macro/ExprTools.hx

+ 1 - 1
src/syntax/ast.ml

@@ -607,7 +607,7 @@ let map_expr loop (e,p) =
 					p
 				else
 					(match new_expr with
-					| (EConst (Ident i),new_pos) -> (FmtIdent i,new_pos)
+					| (EConst (Ident i),_) -> (FmtIdent i,pos)
 					| _ -> (FmtExpr new_expr,pos))
 			| FmtExpr e -> (FmtExpr (loop e), snd p)
 		) parts in

+ 6 - 3
std/haxe/macro/ExprTools.hx

@@ -222,9 +222,12 @@ class ExprTools {
 						var enew = f(efake);
 						if (enew == efake)
 							part
-						else switch enew.expr {
-							case EConst(CIdent(i)): {kind: FIdent(i), pos: enew.pos};
-							case _: {kind: FExpr(enew), pos: part.pos};
+						else {
+							pos: part.pos,
+							kind: switch enew.expr {
+								case EConst(CIdent(i)): FIdent(i);
+								case _: FExpr(enew);
+							}
 						}
 					case FExpr(e): {kind: FExpr(f(e)), pos: part.pos};
 				}]);