Browse Source

[typer] fix forced inline detection (see #3542)

Simon Krajewski 10 years ago
parent
commit
79d97c4ea0
2 changed files with 3 additions and 4 deletions
  1. 2 2
      optimizer.ml
  2. 1 2
      typer.ml

+ 2 - 2
optimizer.ml

@@ -533,7 +533,7 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
 		if not has_params then
 		if not has_params then
 			Some e
 			Some e
 		else
 		else
-(* 			let mt = map_type cf.cf_type in
+ 			let mt = map_type cf.cf_type in
 			let unify_func () = unify_raise ctx mt (TFun (List.map (fun e -> "",false,e.etype) params,tret)) p in
 			let unify_func () = unify_raise ctx mt (TFun (List.map (fun e -> "",false,e.etype) params,tret)) p in
 			(match follow ethis.etype with
 			(match follow ethis.etype with
 			| TAnon a -> (match !(a.a_status) with
 			| TAnon a -> (match !(a.a_status) with
@@ -544,7 +544,7 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
 						unify_raise ctx mt tb p
 						unify_raise ctx mt tb p
 					end
 					end
 				| _ -> unify_func())
 				| _ -> unify_func())
-			| _ -> unify_func()); *)
+			| _ -> unify_func());
 			(*
 			(*
 				this is very expensive since we are building the substitution list for
 				this is very expensive since we are building the substitution list for
 				every expression, but hopefully in such cases the expression size is small
 				every expression, but hopefully in such cases the expression size is small

+ 1 - 2
typer.ml

@@ -696,7 +696,6 @@ let rec unify_call_args' ctx el args r p inline force_inline =
 		default_value name t
 		default_value name t
 	in
 	in
 	(* let force_inline, is_extern = match cf with Some(TInst(c,_),f) -> is_forced_inline (Some c) f, c.cl_extern | _ -> false, false in *)
 	(* let force_inline, is_extern = match cf with Some(TInst(c,_),f) -> is_forced_inline (Some c) f, c.cl_extern | _ -> false, false in *)
-	let force_inline, is_extern = false, false in
 	let type_against t e =
 	let type_against t e =
 		let e = type_expr ctx e (WithTypeResume t) in
 		let e = type_expr ctx e (WithTypeResume t) in
 		(try Codegen.AbstractCast.cast_or_unify_raise ctx t e p with Error (Unify l,p) -> raise (WithTypeError (l,p)));
 		(try Codegen.AbstractCast.cast_or_unify_raise ctx t e p with Error (Unify l,p) -> raise (WithTypeError (l,p)));
@@ -764,7 +763,7 @@ let unify_field_call ctx fa el args ret p inline =
 			else
 			else
 				List.map (fun (t,cf) -> map (monomorphs cf.cf_params t),cf) (Typeload.get_overloads c cf.cf_name)
 				List.map (fun (t,cf) -> map (monomorphs cf.cf_params t),cf) (Typeload.get_overloads c cf.cf_name)
 			in
 			in
-			(TFun(args,ret),cf) :: cfl,None,cf,(fun cf -> FInstance(c,tl,cf))
+			(TFun(args,ret),cf) :: cfl,Some c,cf,(fun cf -> FInstance(c,tl,cf))
 		| _ ->
 		| _ ->
 			error "Invalid field call" p
 			error "Invalid field call" p
 	in
 	in