Ver código fonte

[lua] Emit class name even if not required (#11112)

* [lua] Emit class name even if not required

* [lua] Remove Std static initializer

It seems like those elements get created in generate_class anyway?
Frixuu 2 anos atrás
pai
commit
9cdff6a47c
2 arquivos alterados com 3 adições e 13 exclusões
  1. 3 6
      src/generators/genlua.ml
  2. 0 7
      std/lua/_std/Std.hx

+ 3 - 6
src/generators/genlua.ml

@@ -1608,12 +1608,9 @@ let gen_class_field ctx c f =
 
 let generate_class___name__ ctx c =
     if has_feature ctx "lua.Boot.isClass" then begin
-        let p = s_path ctx c.cl_path in
-        print ctx "%s.__name__ = " p;
-        if has_feature ctx "Type.getClassName" then
-            println ctx "\"%s\"" (String.concat "." (List.map s_escape_lua (fst c.cl_path @ [snd c.cl_path])))
-        else
-            println ctx "true";
+        let flat_path = s_path ctx c.cl_path in
+        let dot_path = String.concat "." (List.map s_escape_lua (fst c.cl_path @ [snd c.cl_path])) in
+        println ctx "%s.__name__ = \"%s\"" flat_path dot_path;
     end
 
 let generate_class ctx c =

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

@@ -96,11 +96,4 @@ import lua.NativeStringTools;
 	public static function random(x:Int):Int {
 		return untyped x <= 0 ? 0 : Math.floor(Math.random() * x);
 	}
-
-	static function __init__():Void
-		untyped {
-			__feature__("lua.Boot.isClass", String.__name__ = __feature__("Type.getClassName", "String", true));
-			__feature__("Type.resolveClass", _hxClasses["Array"] = Array);
-			__feature__("lua.Boot.isClass", Array.__name__ = __feature__("Type.getClassName", "Array", true));
-		}
 }