浏览代码

[lua] adjust order of included lua bootstrap files

Justin Donaldson 9 年之前
父节点
当前提交
84d9a626bf
共有 3 个文件被更改,包括 13 次插入16 次删除
  1. 9 11
      src/generators/genlua.ml
  2. 0 5
      std/lua/Table.hx
  3. 4 0
      std/lua/_std/Std.hx

+ 9 - 11
src/generators/genlua.ml

@@ -1702,6 +1702,15 @@ let generate com =
 	if has_feature ctx "Class" || has_feature ctx "Type.getClassName" then add_feature ctx "lua.Boot.isClass";
 	if has_feature ctx "Class" || has_feature ctx "Type.getClassName" then add_feature ctx "lua.Boot.isClass";
 	if has_feature ctx "Enum" || has_feature ctx "Type.getEnumName" then add_feature ctx "lua.Boot.isEnum";
 	if has_feature ctx "Enum" || has_feature ctx "Type.getEnumName" then add_feature ctx "lua.Boot.isEnum";
 
 
+	let include_files = List.rev com.include_files in
+	List.iter (fun file ->
+		match file with
+		| path, "top" ->
+			let file_content = Std.input_file ~bin:true (fst file) in
+			print ctx "%s\n" file_content;
+			()
+		| _ -> ()
+	) include_files;
 
 
 	let var_exports = (
 	let var_exports = (
 		"_hx_exports",
 		"_hx_exports",
@@ -1741,17 +1750,6 @@ let generate com =
 		in loop parts "";
 		in loop parts "";
 	)) exposed;
 	)) exposed;
 
 
-	let include_files = List.rev com.include_files in
-
-
-	List.iter (fun file ->
-		match file with
-		| path, "top" ->
-			let file_content = Std.input_file ~bin:true (fst file) in
-			print ctx "%s\n" file_content;
-			()
-		| _ -> ()
-	) include_files;
 
 
 	if (anyExposed) then (
 	if (anyExposed) then (
 		print ctx "local %s = %s" (fst var_exports) (snd var_exports);
 		print ctx "local %s = %s" (fst var_exports) (snd var_exports);

+ 0 - 5
std/lua/Table.hx

@@ -25,11 +25,6 @@ extern class Table<A,B> implements ArrayAccess<B> implements Dynamic<B> {
 	private static function __init__() : Void {
 	private static function __init__() : Void {
 		// lua table polyfills
 		// lua table polyfills
 		haxe.macro.Compiler.includeFile("lua/_lua/_hx_table_polyfill.lua");
 		haxe.macro.Compiler.includeFile("lua/_lua/_hx_table_polyfill.lua");
-
-		// lua workarounds for basic anonymous object functionality
-		// (built on tables)
-		haxe.macro.Compiler.includeFile("lua/_lua/_hx_anon.lua");
-
 	}
 	}
 }
 }
 
 

+ 4 - 0
std/lua/_std/Std.hx

@@ -80,6 +80,10 @@ import lua.NativeStringTools;
 	}
 	}
 
 
 	static function __init__() : Void untyped {
 	static function __init__() : Void untyped {
+		// lua workarounds for basic anonymous object functionality
+		haxe.macro.Compiler.includeFile("lua/_lua/_hx_anon.lua");
+
+		// class reflection metadata
 		haxe.macro.Compiler.includeFile("lua/_lua/_hx_classes.lua");
 		haxe.macro.Compiler.includeFile("lua/_lua/_hx_classes.lua");
 		__feature__("lua.Boot.getClass", String.prototype.__class__ = __feature__("Type.resolveClass",_hxClasses["String"] = String,String));
 		__feature__("lua.Boot.getClass", String.prototype.__class__ = __feature__("Type.resolveClass",_hxClasses["String"] = String,String));
 		__feature__("lua.Boot.isClass", String.__name__ = __feature__("Type.getClassName", __lua_table__("String"),true));
 		__feature__("lua.Boot.isClass", String.__name__ = __feature__("Type.getClassName", __lua_table__("String"),true));