Prechádzať zdrojové kódy

allow having multiple types in the Array module

Dan Korostelev 11 rokov pred
rodič
commit
d14fdc8ae8
1 zmenil súbory, kde vykonal 10 pridanie a 3 odobranie
  1. 10 3
      typer.ml

+ 10 - 3
typer.ml

@@ -4274,9 +4274,16 @@ let rec create com =
 	| [TClassDecl c] -> ctx.t.tstring <- TInst (c,[])
 	| [TClassDecl c] -> ctx.t.tstring <- TInst (c,[])
 	| _ -> assert false);
 	| _ -> assert false);
 	let m = Typeload.load_module ctx ([],"Array") null_pos in
 	let m = Typeload.load_module ctx ([],"Array") null_pos in
-	(match m.m_types with
-	| [TClassDecl c] -> ctx.t.tarray <- (fun t -> TInst (c,[t]))
-	| _ -> assert false);
+	(try
+		List.iter (fun t -> (
+			match t with
+			| TClassDecl ({cl_path = ([],"Array")} as c) ->
+				ctx.t.tarray <- (fun t -> TInst (c,[t]));
+				raise Exit
+			| _ -> ()
+		)) m.m_types;
+		assert false
+	with Exit -> ());
 	let m = Typeload.load_module ctx (["haxe"],"EnumTools") null_pos in
 	let m = Typeload.load_module ctx (["haxe"],"EnumTools") null_pos in
 	(match m.m_types with
 	(match m.m_types with
 	| [TClassDecl c1;TClassDecl c2] -> ctx.g.global_using <- c1 :: c2 :: ctx.g.global_using
 	| [TClassDecl c1;TClassDecl c2] -> ctx.g.global_using <- c1 :: c2 :: ctx.g.global_using