Sfoglia il codice sorgente

fixed errors when accessing std package with haxe the classpath (close #2193)

Nicolas Cannasse 12 anni fa
parent
commit
3682ed0278
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      typeload.ml

+ 6 - 0
typeload.ml

@@ -2385,6 +2385,12 @@ let resolve_module_file com m remap p =
 		if (try (Unix.stat file).Unix.st_size with _ -> 0) > 0 then file else raise Not_found
 	| _ -> file
 	) in
+	(* if we try to load a std.xxxx class and resolve a real std file, the package name is not valid, ignore *)
+	(match fst m with
+	| "std" :: _ ->
+		let file = Common.unique_full_path file in
+		if List.exists (fun path -> ExtString.String.starts_with file (try Common.unique_full_path path with _ -> path)) com.std_path then raise Not_found;
+	| _ -> ());
 	if !forbid then begin
 		let _, decls = (!parse_hook) com file p in
 		let meta = (match decls with