Explorar o código

__ prefix -> std + first lookup in real 'std' package

Nicolas Cannasse %!s(int64=13) %!d(string=hai) anos
pai
achega
4c1a4e0729
Modificáronse 5 ficheiros con 13 adicións e 6 borrados
  1. 1 1
      doc/CHANGES.txt
  2. 1 1
      std/cpp/Sys.hx
  3. 1 1
      std/neko/Sys.hx
  4. 1 1
      std/php/Sys.hx
  5. 9 2
      typeload.ml

+ 1 - 1
doc/CHANGES.txt

@@ -35,7 +35,7 @@
 	all : null, true and false are now keywords
 	all : null, true and false are now keywords
 	all : neko.io.Path, cpp.io.Path and php.io.Path are now haxe.io.Path
 	all : neko.io.Path, cpp.io.Path and php.io.Path are now haxe.io.Path
 	neko, cpp, php : added Sys class, sys.io and sys.net packages and "sys" define
 	neko, cpp, php : added Sys class, sys.io and sys.net packages and "sys" define
-	all : allow to access root package with __ prefix (__.Type for example)
+	all : allow to access root package with std prefix (std.Type for example)
 
 
 2011-09-25: 2.08
 2011-09-25: 2.08
 	js : added js.JQuery
 	js : added js.JQuery

+ 1 - 1
std/cpp/Sys.hx

@@ -1,5 +1,5 @@
 package cpp;
 package cpp;
 
 
 #if !haxe3
 #if !haxe3
-typedef Sys = __.Sys
+typedef Sys = std.Sys
 #end
 #end

+ 1 - 1
std/neko/Sys.hx

@@ -1,5 +1,5 @@
 package neko;
 package neko;
 
 
 #if !haxe3
 #if !haxe3
-typedef Sys = __.Sys;
+typedef Sys = std.Sys;
 #end
 #end

+ 1 - 1
std/php/Sys.hx

@@ -1,5 +1,5 @@
 package php;
 package php;
 
 
 #if !haxe3
 #if !haxe3
-typedef Sys = __.Sys
+typedef Sys = std.Sys
 #end
 #end

+ 9 - 2
typeload.ml

@@ -76,8 +76,15 @@ let rec load_type_def ctx p t =
 	with
 	with
 		Not_found ->
 		Not_found ->
 			let next() =
 			let next() =
-				let t = (match t.tpackage with "__" :: l -> { t with tpackage = l } | _ -> t) in
-				let m = ctx.g.do_load_module ctx (t.tpackage,t.tname) p in
+				let t, m = (try
+					t, ctx.g.do_load_module ctx (t.tpackage,t.tname) p
+				with Error (Module_not_found _,p2) as e when p == p2 -> 
+					match t.tpackage with
+					| "std" :: l ->
+						let t = { t with tpackage = l } in
+						t, ctx.g.do_load_module ctx (t.tpackage,t.tname) p
+					| _ -> raise e
+				) in
 				let tpath = (t.tpackage,tname) in
 				let tpath = (t.tpackage,tname) in
 				try
 				try
 					List.find (fun t -> not (t_infos t).mt_private && t_path t = tpath) m.m_types
 					List.find (fun t -> not (t_infos t).mt_private && t_path t = tpath) m.m_types