Browse Source

"throw" treated as "return" in return_flow.

Nicolas Cannasse 19 năm trước cách đây
mục cha
commit
58e31e4992
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      typer.ml

+ 2 - 2
typer.ml

@@ -253,14 +253,14 @@ let t_iterator ctx =
 let rec return_flow e =
 let rec return_flow e =
 	let error() = error "A return is missing here" e.epos in
 	let error() = error "A return is missing here" e.epos in
 	match e.eexpr with
 	match e.eexpr with
-	| TReturn _ -> ()
+	| TReturn _ | TThrow _ -> ()
 	| TParenthesis e -> 
 	| TParenthesis e -> 
 		return_flow e
 		return_flow e
 	| TBlock el ->
 	| TBlock el ->
 		let rec loop = function
 		let rec loop = function
 			| [] -> error()
 			| [] -> error()
 			| [e] -> return_flow e
 			| [e] -> return_flow e
-			| { eexpr = TReturn _ } :: _ -> ()
+			| { eexpr = TReturn _ } :: _ | { eexpr = TThrow _ } :: _ -> ()			
 			| _ :: l -> loop l
 			| _ :: l -> loop l
 		in
 		in
 		loop el
 		loop el