Browse Source

[std] remove load_core_type, use std.Path resolution instead

This should be the same, maybe.
Simon Krajewski 2 years ago
parent
commit
247a4590eb
4 changed files with 3 additions and 18 deletions
  1. 1 1
      src/typing/operators.ml
  2. 0 15
      src/typing/typeload.ml
  3. 1 1
      src/typing/typeloadModule.ml
  4. 1 1
      src/typing/typer.ml

+ 1 - 1
src/typing/operators.ml

@@ -392,7 +392,7 @@ let make_binop ctx op e1 e2 is_assign_op with_type p =
 		unify ctx e2.etype b p;
 		unify ctx e2.etype b p;
 		mk_op e1 e2 b
 		mk_op e1 e2 b
 	| OpInterval ->
 	| OpInterval ->
-		let t = Typeload.load_core_type ctx "IntIterator" in
+		let t = Typeload.load_instance ctx (mk_type_path (["std"],"IntIterator"),null_pos) false in
 		let e1 = AbstractCast.cast_or_unify_raise ctx tint e1 e1.epos in
 		let e1 = AbstractCast.cast_or_unify_raise ctx tint e1 e1.epos in
 		let e2 = AbstractCast.cast_or_unify_raise ctx tint e2 e2.epos in
 		let e2 = AbstractCast.cast_or_unify_raise ctx tint e2 e2.epos in
 		BinopSpecial (mk (TNew ((match t with TInst (c,[]) -> c | _ -> die "" __LOC__),[],[e1;e2])) t p,false)
 		BinopSpecial (mk (TNew ((match t with TInst (c,[]) -> c | _ -> die "" __LOC__),[],[e1;e2])) t p,false)

+ 0 - 15
src/typing/typeload.ml

@@ -714,21 +714,6 @@ let hide_params ctx =
 		ctx.g.std.m_extra.m_deps <- old_deps;
 		ctx.g.std.m_extra.m_deps <- old_deps;
 	)
 	)
 
 
-(*
-	load a type while ignoring the current imports or local types
-*)
-let load_core_type ctx name =
-	let show = hide_params ctx in
-	let t = load_instance ctx (mk_type_path ([],name),null_pos) false in
-	show();
-	add_dependency ctx.m.curmod (match t with
-	| TInst (c,_) -> c.cl_module
-	| TType (t,_) -> t.t_module
-	| TAbstract (a,_) -> a.a_module
-	| TEnum (e,_) -> e.e_module
-	| _ -> die "" __LOC__);
-	t
-
 let t_iterator ctx =
 let t_iterator ctx =
 	let show = hide_params ctx in
 	let show = hide_params ctx in
 	match load_type_def ctx null_pos (mk_type_path ([],"Iterator")) with
 	match load_type_def ctx null_pos (mk_type_path ([],"Iterator")) with

+ 1 - 1
src/typing/typeloadModule.ml

@@ -759,7 +759,7 @@ let type_types_into_module ctx m tdecls p =
 	if ctx.g.std != null_module then begin
 	if ctx.g.std != null_module then begin
 		add_dependency m ctx.g.std;
 		add_dependency m ctx.g.std;
 		(* this will ensure both String and (indirectly) Array which are basic types which might be referenced *)
 		(* this will ensure both String and (indirectly) Array which are basic types which might be referenced *)
-		ignore(load_core_type ctx "String");
+		ignore(load_instance ctx (mk_type_path (["std"],"String"),null_pos) false)
 	end;
 	end;
 	ModuleLevel.init_type_params ctx decls;
 	ModuleLevel.init_type_params ctx decls;
 	(* setup module types *)
 	(* setup module types *)

+ 1 - 1
src/typing/typer.ml

@@ -1854,7 +1854,7 @@ and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
 	| EConst (Regexp (r,opt)) ->
 	| EConst (Regexp (r,opt)) ->
 		let str = mk (TConst (TString r)) ctx.t.tstring p in
 		let str = mk (TConst (TString r)) ctx.t.tstring p in
 		let opt = mk (TConst (TString opt)) ctx.t.tstring p in
 		let opt = mk (TConst (TString opt)) ctx.t.tstring p in
-		let t = Typeload.load_core_type ctx "EReg" in
+		let t = Typeload.load_instance ctx (mk_type_path (["std"],"EReg"),null_pos) false in
 		mk (TNew ((match t with TInst (c,[]) -> c | _ -> die "" __LOC__),[],[str;opt])) t p
 		mk (TNew ((match t with TInst (c,[]) -> c | _ -> die "" __LOC__),[],[str;opt])) t p
 	| EConst (String(s,SSingleQuotes)) when s <> "" ->
 	| EConst (String(s,SSingleQuotes)) when s <> "" ->
 		type_expr ctx (format_string ctx s p) with_type
 		type_expr ctx (format_string ctx s p) with_type