Simon Krajewski 12 years ago
parent
commit
b8140f44c4
2 changed files with 5 additions and 4 deletions
  1. 1 1
      std/haxe/macro/ExprTools.hx
  2. 4 3
      type.ml

+ 1 - 1
std/haxe/macro/ExprTools.hx

@@ -78,7 +78,7 @@ class ExprTools {
 			case EConst(_),
 				EContinue,
 				EBreak,
-				EDisplayNew:
+				EDisplayNew(_):
 			case EField(e, _),
 				EParenthesis(e),
 				EUntyped(e),

+ 4 - 3
type.ml

@@ -1506,12 +1506,13 @@ let rec s_expr_pretty tabs s_type e =
 		sprintf "switch (%s) {%s%s}" (loop e) (slist (fun (cl,e) -> sprintf "case %s: %s" (slist loop cl) (loop e)) cases) (match def with None -> "" | Some e -> ",default: " ^ loop e)
 	| TMatch (e,(en,tparams),cases,def) ->
 		let cases = slist (fun (il,vl,e) ->
-			let ctor = PMap.find (List.nth en.e_names (List.nth il 0)) en.e_constrs in
+			let ctor i = (PMap.find (List.nth en.e_names i) en.e_constrs).ef_name in
+			let ctors = String.concat "," (List.map ctor il) in
 			begin match vl with
 				| None ->
-					sprintf "case %s:%s" ctor.ef_name (loop e)
+					sprintf "case %s:%s" ctors (loop e)
 				| Some vl ->
-					sprintf "case %s(%s):%s" ctor.ef_name (String.concat "," (List.map (fun v -> match v with None -> "_" | Some v -> v.v_name) vl)) (loop e)
+					sprintf "case %s(%s):%s" ctors (String.concat "," (List.map (fun v -> match v with None -> "_" | Some v -> v.v_name) vl)) (loop e)
 			end
 		) cases in
 		sprintf "switch (%s) {%s%s}" (loop e) cases (match def with None -> "" | Some e -> ",default: " ^ loop e)