Przeglądaj źródła

[As3] we can only get public fields through Type reflection

Simon Krajewski 12 lat temu
rodzic
commit
d64a4f086c

+ 4 - 0
std/Type.hx

@@ -203,6 +203,8 @@ extern class Type {
 		The order of the fields in the returned Array is unspecified.
 		
 		If [c] is null, the result is unspecified.
+		
+		(As3) This method only returns instance fields that are public.
 	**/
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
 
@@ -214,6 +216,8 @@ extern class Type {
 		The order of the fields in the returned Array is unspecified.
 		
 		If [c] is null, the result is unspecified.
+		
+		(As3) This method only returns class fields that are public.
 	**/
 	public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
 

+ 1 - 1
tests/unit/TestSpecification.hx

@@ -12,7 +12,7 @@ typedef T = {
 	public var prop(default, null):String;
 	
 	static function staticFunc() { }
-	static var staticVar:String;
+	static public var staticVar:String;
 	static var staticProp(default, null):String;
 	
 	public function new() {

+ 1 - 1
tests/unit/unitstd/Type.unit.hx

@@ -104,7 +104,7 @@ for (f in fields)
 	t(requiredFields.remove(f));
 requiredFields == [];
 var fields = Type.getClassFields(C);
-var requiredFields = ["staticFunc", "staticVar", "staticProp"];
+var requiredFields = #if as3 ["staticVar"] #else ["staticFunc", "staticVar", "staticProp"] #end;
 for (f in fields)
 	t(requiredFields.remove(f));
 requiredFields == [];