Bläddra i källkod

fix overzealous regex refactoring

Simon Krajewski 11 år sedan
förälder
incheckning
05ef93a46d
5 ändrade filer med 22 tillägg och 22 borttagningar
  1. 1 1
      codegen.ml
  2. 1 1
      gencommon.ml
  3. 1 1
      typecore.ml
  4. 9 9
      typeload.ml
  5. 10 10
      typer.ml

+ 1 - 1
codegen.ml

@@ -307,7 +307,7 @@ let rec build_generic ctx c p tl =
 		Typeload.load_instance ctx { tpackage = pack; tname = name; tparams = []; tsub = None } p false
 	with Error(Module_not_found path,_) when path = (pack,name) ->
 		let m = (try Hashtbl.find ctx.g.modules (Hashtbl.find ctx.g.types_module c.cl_path) with Not_found -> assert false) in
-		let ctx = { ctx with m = { ctx.m with module_params = m.m_types @ ctx.m.module_params } } in
+		let ctx = { ctx with m = { ctx.m with module_types = m.m_types @ ctx.m.module_types } } in
 		c.cl_build(); (* make sure the super class is already setup *)
 		let mg = {
 			m_id = alloc_mid();

+ 1 - 1
gencommon.ml

@@ -536,7 +536,7 @@ type generator_ctx =
 	(* add type can be called at any time, and will add a new module_def that may or may not be filtered *)
 	(* module_type -> should_filter *)
 	mutable gadd_type : module_type -> bool -> unit;
-	(* during expr filters, add_to_module will be available so module_params can be added to current module_def. we must pass the priority argument so the filters can be resumed	*)
+	(* during expr filters, add_to_module will be available so module_types can be added to current module_def. we must pass the priority argument so the filters can be resumed	*)
 	mutable gadd_to_module : module_type -> float -> unit;
 	(* during expr filters, shows the current class path *)
 	mutable gcurrent_path : path;

+ 1 - 1
typecore.ml

@@ -82,7 +82,7 @@ type typer_globals = {
 
 and typer_module = {
 	curmod : module_def;
-	mutable module_params : module_type list;
+	mutable module_types : module_type list;
 	mutable module_using : tclass list;
 	mutable module_globals : (string, (module_type * string)) PMap.t;
 	mutable wildcard_packages : string list list;

+ 9 - 9
typeload.ml

@@ -257,7 +257,7 @@ let rec load_type_def ctx p t =
 		List.find (fun t2 ->
 			let tp = t_path t2 in
 			tp = (t.tpackage,tname) || (no_pack && snd tp = tname)
-		) (ctx.m.curmod.m_types @ ctx.m.module_params)
+		) (ctx.m.curmod.m_types @ ctx.m.module_types)
 	with
 		Not_found ->
 			let next() =
@@ -617,7 +617,7 @@ let hide_params ctx =
 	let old_deps = ctx.g.std.m_extra.m_deps in
 	ctx.m <- {
 		curmod = ctx.g.std;
-		module_params = [];
+		module_types = [];
 		module_using = [];
 		module_globals = PMap.empty;
 		wildcard_packages = [];
@@ -1153,7 +1153,7 @@ let set_heritance ctx c herits p =
 		| [] ->
 			try
 				let find = List.find (fun lt -> snd (t_path lt) = t.tname) in
-				let lt = try find ctx.m.curmod.m_types with Not_found -> find ctx.m.module_params in
+				let lt = try find ctx.m.curmod.m_types with Not_found -> find ctx.m.module_types in
 				{ t with tpackage = fst (t_path lt) }
 			with
 				Not_found -> t
@@ -2373,15 +2373,15 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 				| [] ->
 					(match name with
 					| None ->
-						ctx.m.module_params <- List.filter no_private types @ ctx.m.module_params
+						ctx.m.module_types <- List.filter no_private types @ ctx.m.module_types
 					| Some newname ->
-						ctx.m.module_params <- rebind (get_type tname) newname :: ctx.m.module_params);
+						ctx.m.module_types <- rebind (get_type tname) newname :: ctx.m.module_types);
 				| [tsub,p2] ->
 					let p = punion p1 p2 in
 					(try
 						let tsub = List.find (has_name tsub) types in
 						chk_private tsub p;
-						ctx.m.module_params <- (match name with None -> tsub | Some n -> rebind tsub n) :: ctx.m.module_params
+						ctx.m.module_types <- (match name with None -> tsub | Some n -> rebind tsub n) :: ctx.m.module_types
 					with Not_found ->
 						(* this might be a static property, wait later to check *)
 						let tmain = get_type tname in
@@ -2427,11 +2427,11 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 			| None ->
 				let md = ctx.g.do_load_module ctx (t.tpackage,t.tname) p in
 				let types = List.filter (fun t -> not (t_infos t).mt_private) md.m_types in
-				ctx.m.module_params <- types @ ctx.m.module_params;
+				ctx.m.module_types <- types @ ctx.m.module_types;
 				types
 			| Some _ ->
 				let t = load_type_def ctx p t in
-				ctx.m.module_params <- t :: ctx.m.module_params;
+				ctx.m.module_types <- t :: ctx.m.module_types;
 				[t]
 		) in
 		(* delay the using since we need to resolve typedefs *)
@@ -2652,7 +2652,7 @@ let type_module ctx m file tdecls p =
 		t = ctx.t;
 		m = {
 			curmod = m;
-			module_params = ctx.g.std.m_types;
+			module_types = ctx.g.std.m_types;
 			module_using = [];
 			module_globals = PMap.empty;
 			wildcard_packages = [];

+ 10 - 10
typer.ml

@@ -413,7 +413,7 @@ let collect_toplevel_identifiers ctx =
 			) e.e_constrs;
 	in
 	List.iter enum_ctors ctx.m.curmod.m_types;
-	List.iter enum_ctors ctx.m.module_params;
+	List.iter enum_ctors ctx.m.module_types;
 
 	(* imported globals *)
 	PMap.iter (fun _ (mt,s) ->
@@ -429,21 +429,21 @@ let collect_toplevel_identifiers ctx =
 			()
 	) ctx.m.module_globals;
 
-	let module_params = ref [] in
+	let module_types = ref [] in
 
 	let add_type mt =
 		match mt with
 		| TClassDecl {cl_kind = KAbstractImpl _} -> ()
 		| _ ->
 			let path = (t_infos mt).mt_path in
-			if not (List.exists (fun mt2 -> (t_infos mt2).mt_path = path) !module_params) then module_params := mt :: !module_params
+			if not (List.exists (fun mt2 -> (t_infos mt2).mt_path = path) !module_types) then module_types := mt :: !module_types
 	in
 
 	(* module types *)
 	List.iter add_type ctx.m.curmod.m_types;
 
 	(* module imports *)
-	List.iter add_type ctx.m.module_params;
+	List.iter add_type ctx.m.module_types;
 
 	(* module using *)
 	List.iter (fun c ->
@@ -501,7 +501,7 @@ let collect_toplevel_identifiers ctx =
 
 	List.iter (fun mt ->
 		DynArray.add acc (ITType mt)
-	) !module_params;
+	) !module_types;
 
 	raise (DisplayToplevel (DynArray.to_list acc))
 
@@ -1322,7 +1322,7 @@ let rec type_ident_raise ?(imported_enums=true) ctx i p mode =
 					with
 						Not_found -> loop l
 		in
-		(try loop (List.rev ctx.m.curmod.m_types) with Not_found -> loop ctx.m.module_params)
+		(try loop (List.rev ctx.m.curmod.m_types) with Not_found -> loop ctx.m.module_types)
 	with Not_found ->
 		(* lookup imported globals *)
 		let t, name = PMap.find i ctx.m.module_globals in
@@ -2495,7 +2495,7 @@ and type_access ctx e p mode =
 						(match pack with
 						| [] ->
 							(try
-								let t = List.find (fun t -> snd (t_infos t).mt_path = name) (ctx.m.curmod.m_types @ ctx.m.module_params) in
+								let t = List.find (fun t -> snd (t_infos t).mt_path = name) (ctx.m.curmod.m_types @ ctx.m.module_types) in
 								(* if the static is not found, look for a subtype instead - #1916 *)
 								get_static true t
 							with Not_found ->
@@ -4481,7 +4481,7 @@ let load_macro ctx cpath f p =
 	let mloaded = Typeload.load_module mctx m p in
 	mctx.m <- {
 		curmod = mloaded;
-		module_params = [];
+		module_types = [];
 		module_using = [];
 		module_globals = PMap.empty;
 		wildcard_packages = [];
@@ -4728,7 +4728,7 @@ let rec create com =
 		};
 		m = {
 			curmod = null_module;
-			module_params = [];
+			module_types = [];
 			module_using = [];
 			module_globals = PMap.empty;
 			wildcard_packages = [];
@@ -4761,7 +4761,7 @@ let rec create com =
 		Error (Module_not_found ([],"StdTypes"),_) -> error "Standard library not found" null_pos
 	);
 	(* We always want core types to be available so we add them as default imports (issue #1904 and #3131). *)
-	ctx.m.module_params <- ctx.g.std.m_types;
+	ctx.m.module_types <- ctx.g.std.m_types;
 	List.iter (fun t ->
 		match t with
 		| TAbstractDecl a ->