Просмотр исходного кода

Lua: fix setProperty for static class variables

Justin Donaldson 9 лет назад
Родитель
Сommit
b4851d8106
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      std/lua/_std/Reflect.hx

+ 10 - 1
std/lua/_std/Reflect.hx

@@ -50,7 +50,16 @@ import lua.Boot;
 
 	public static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {
 		var tmp : String;
-		if( o.__properties__ && (tmp=o.__properties__["set_"+field]) ) callMethod(o,Reflect.field(o, tmp), [value]) else o[field] = __define_feature__("Reflect.setProperty",value);
+		if( o.__properties__ && o.__properties__["set_"+field]) {
+			tmp = o.__properties__["set_" + field];
+			if (o.__name__ != null){
+				callMethod(null,Reflect.field(o, tmp), [value]) ;
+			} else {
+				callMethod(o,Reflect.field(o, tmp), [value]) ;
+			}
+		} else {
+			o[field] = __define_feature__("Reflect.setProperty",value);
+		}
 	}
 
 	public inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array<Dynamic> ) : Dynamic  {