Browse Source

Add basic.tany

Rudy Ges 1 year ago
parent
commit
e3ee405df9
3 changed files with 14 additions and 0 deletions
  1. 2 0
      src/context/common.ml
  2. 1 0
      src/core/tType.ml
  3. 11 0
      src/typing/typerEntry.ml

+ 2 - 0
src/context/common.ml

@@ -826,6 +826,7 @@ let create compilation_step cs version args display_mode =
 		pass_debug_messages = DynArray.create();
 		basic = {
 			tvoid = mk_mono();
+			tany = mk_mono();
 			tint = mk_mono();
 			tfloat = mk_mono();
 			tbool = mk_mono();
@@ -873,6 +874,7 @@ let clone com is_macro_context =
 		cache = None;
 		basic = { t with
 			tvoid = mk_mono();
+			tany = mk_mono();
 			tint = mk_mono();
 			tfloat = mk_mono();
 			tbool = mk_mono();

+ 1 - 0
src/core/tType.ml

@@ -454,6 +454,7 @@ exception Type_exception of t
 
 type basic_types = {
 	mutable tvoid : t;
+	mutable tany : t;
 	mutable tint : t;
 	mutable tfloat : t;
 	mutable tbool : t;

+ 11 - 0
src/typing/typerEntry.ml

@@ -127,6 +127,17 @@ let create com macros =
 		| TClassDecl ({cl_path = ([],"Std")} as c) -> ctx.com.std <- c;
 		| _ -> ()
 	) m.m_types;
+	let m = TypeloadModule.load_module ctx ([],"Any") null_pos in
+	List.iter (fun mt -> match mt with
+		| TAbstractDecl a ->
+			(match snd a.a_path with
+			| "Any" ->
+				let t = TAbstract (a,[]) in
+				Type.unify t ctx.t.tany;
+				ctx.t.tany <- t;
+			| _ -> ())
+		| _ -> ()
+	) m.m_types;
 	let m = TypeloadModule.load_module ctx ([],"Array") null_pos in
 	(try
 		List.iter (fun t -> (