Преглед на файлове

implement _hx_AnonObject in Haxe

Simon Krajewski преди 11 години
родител
ревизия
58b01deaea
променени са 2 файла, в които са добавени 10 реда и са изтрити 4 реда
  1. 1 0
      genpy.ml
  2. 9 4
      std/python/Boot.hx

+ 1 - 0
genpy.ml

@@ -1935,6 +1935,7 @@ module Generator = struct
 			Utils.find_type ctx.com path
 		in
 		gen_type ctx (find_type ([],"_hx_ClassRegistry"));
+		gen_type ctx (find_type ([],"_hx_AnonObject"));
 		gen_type ctx (find_type (["python"],"Boot"));
 		gen_type ctx (find_type ([],"Enum"));
 		gen_type ctx (find_type ([],"HxOverrides"));

+ 9 - 4
std/python/Boot.hx

@@ -92,12 +92,17 @@ private class ClassRegistry extends python.lib.Dict<String, HxClassBase> {
     }
 }
 
+@:keep
+@:nativeGen
+@:native("_hx_AnonObject")
+class AnonObject extends python.lib.Object {
+	public function new(fields) {
+		this.__dict__ = fields;
+	}
+}
+
 @:preCode("
 _hx_classes = _hx_ClassRegistry()
-
-class _hx_AnonObject(object):
-	def __init__(self, fields):
-		self.__dict__ = fields
 ")
 @:keep class Boot {