Browse Source

fixed type issue with inlined TMatch

Nicolas Cannasse 14 years ago
parent
commit
278c703125
1 changed files with 2 additions and 2 deletions
  1. 2 2
      optimizer.ml

+ 2 - 2
optimizer.ml

@@ -116,7 +116,7 @@ let rec type_inline ctx cf f ethis params tret p =
 			let e2 = map false e2 in
 			let e2 = map false e2 in
 			old();
 			old();
 			{ e with eexpr = TFor (v,t,e1,e2) }
 			{ e with eexpr = TFor (v,t,e1,e2) }
-		| TMatch (e,en,cases,def) ->
+		| TMatch (v,en,cases,def) ->
 			let term, t = (match def with Some d when term -> true, ref d.etype | _ -> false, ref e.etype) in
 			let term, t = (match def with Some d when term -> true, ref d.etype | _ -> false, ref e.etype) in
 			let cases = List.map (fun (i,vl,e) ->
 			let cases = List.map (fun (i,vl,e) ->
 				let old = save_locals ctx in
 				let old = save_locals ctx in
@@ -126,7 +126,7 @@ let rec type_inline ctx cf f ethis params tret p =
 				old();
 				old();
 				i, vl, e
 				i, vl, e
 			) cases in
 			) cases in
-			{ e with eexpr = TMatch (map false e,en,cases,opt (map term) def); etype = !t }
+			{ e with eexpr = TMatch (map false v,en,cases,opt (map term) def); etype = !t }
 		| TTry (e1,catches) ->
 		| TTry (e1,catches) ->
 			{ e with eexpr = TTry (map term e1,List.map (fun (v,t,e) ->
 			{ e with eexpr = TTry (map term e1,List.map (fun (v,t,e) ->
 				let old = save_locals ctx in
 				let old = save_locals ctx in