2
0
Эх сурвалжийг харах

don't try to keep going if switch expression causes typing errors (fixed issue #1546)

Simon Krajewski 12 жил өмнө
parent
commit
d0120a60fe
1 өөрчлөгдсөн 8 нэмэгдсэн , 2 устгасан
  1. 8 2
      matcher.ml

+ 8 - 2
matcher.ml

@@ -1088,7 +1088,9 @@ let match_expr ctx e cases def with_type p =
 			cases @ [[(EConst(Ident "_")),p],None,def]
 			cases @ [[(EConst(Ident "_")),p],None,def]
 		| _ -> cases
 		| _ -> cases
 	in
 	in
-	let evals = match fst e with
+	let old_error = ctx.on_error in
+	ctx.on_error <- (fun ctx s p -> ctx.on_error <- old_error; error s p);
+	let evals = try (match fst e with
 		| EArrayDecl el | EParenthesis(EArrayDecl el,_) ->
 		| EArrayDecl el | EParenthesis(EArrayDecl el,_) ->
 			List.map (fun e -> type_expr ctx e Value) el
 			List.map (fun e -> type_expr ctx e Value) el
 		| _ ->
 		| _ ->
@@ -1099,8 +1101,12 @@ let match_expr ctx e cases def with_type p =
 			| _ ->
 			| _ ->
 				()
 				()
 			end;
 			end;
-			[e]
+			[e])
+		with e ->
+			ctx.on_error <- old_error;
+			raise e
 	in
 	in
+	ctx.on_error <- old_error;
 	let var_inits = ref [] in
 	let var_inits = ref [] in
 	let a = List.length evals in
 	let a = List.length evals in
 	let stl = ExtList.List.mapi (fun i e ->
 	let stl = ExtList.List.mapi (fun i e ->