SHOW:
|
|
- or go back to the newest paste.
| 1 | import haxe.rtti.Meta; | |
| 2 | using Reflect; | |
| 3 | ||
| 4 | class Foo | |
| 5 | {
| |
| 6 | @test | |
| 7 | public var bar:String; | |
| 8 | } | |
| 9 | ||
| 10 | class Main | |
| 11 | {
| |
| 12 | public static function main() | |
| 13 | - | var meta = haxe.rtti.Meta.getFields(Foo); |
| 13 | + | |
| 14 | var meta = Meta.getFields(Foo); | |
| 15 | - | var fields = Reflect.fields(meta); |
| 15 | + | |
| 16 | - | var fields = meta.fields(); //You can't iterate on a Dynamic value, please specify Iterator or Iterable |
| 16 | + | var fields = Reflect.fields(meta); //OK |
| 17 | for(f in fields) //OK | |
| 18 | - | for(f in fields) |
| 18 | + | |
| 19 | ||
| 20 | var fields = meta.fields();//Runtime error: fields is not a function | |
| 21 | for(f in fields) //Compiler error : You can't iterate on a Dynamic value | |
| 22 | trace(f); | |
| 23 | } | |
| 24 | } |