OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:mirrors"; | 5 import "dart:mirrors"; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 doNothing42() {} | 9 doNothing42() {} |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 Expect.equals(method.isSetter, kinds[3]); | 41 Expect.equals(method.isSetter, kinds[3]); |
42 Expect.equals(method.isConstructor, kinds[4]); | 42 Expect.equals(method.isConstructor, kinds[4]); |
43 } | 43 } |
44 | 44 |
45 main() { | 45 main() { |
46 // Top level functions should be static. | 46 // Top level functions should be static. |
47 var closureMirror = reflect(doNothing42); | 47 var closureMirror = reflect(doNothing42); |
48 checkKinds(closureMirror.function, | 48 checkKinds(closureMirror.function, |
49 [true, false, false, false, false]); | 49 [true, false, false, false, false]); |
50 var libraryMirror = reflectClass(C).owner; | 50 var libraryMirror = reflectClass(C).owner; |
51 checkKinds(libraryMirror.getters[#topGetter], | 51 checkKinds(libraryMirror.declarations[#topGetter], |
52 [true, false, true, false, false]); | 52 [true, false, true, false, false]); |
53 checkKinds(libraryMirror.setters[const Symbol("topSetter=")], | 53 checkKinds(libraryMirror.declarations[const Symbol("topSetter=")], |
54 [true, false, false, true, false]); | 54 [true, false, false, true, false]); |
55 var classMirror; | 55 var classMirror; |
56 classMirror = reflectClass(C); | 56 classMirror = reflectClass(C); |
57 checkKinds(classMirror.members[#foo], | 57 checkKinds(classMirror.declarations[#foo], |
58 [true, false, false, false, false]); | 58 [true, false, false, false, false]); |
59 checkKinds(classMirror.members[#priv], | 59 checkKinds(classMirror.declarations[#priv], |
60 [false, false, true, false, false]); | 60 [false, false, true, false, false]); |
61 checkKinds(classMirror.members[const Symbol("priv=")], | 61 checkKinds(classMirror.declarations[const Symbol("priv=")], |
62 [false, false, false, true, false]); | 62 [false, false, false, true, false]); |
63 checkKinds(classMirror.constructors[#C], | 63 checkKinds(classMirror.declarations[#C], |
64 [false, false, false, false, true]); | 64 [false, false, false, false, true]); |
65 checkKinds(classMirror.constructors[#C.other], | 65 checkKinds(classMirror.declarations[#C.other], |
66 [false, false, false, false, true]); | 66 [false, false, false, false, true]); |
67 checkKinds(classMirror.constructors[#C.other2], | 67 checkKinds(classMirror.declarations[#C.other2], |
68 [false, false, false, false, true]); | 68 [false, false, false, false, true]); |
69 classMirror = reflectClass(AbstractC); | 69 classMirror = reflectClass(AbstractC); |
70 checkKinds(classMirror.constructors[#AbstractC], | 70 checkKinds(classMirror.declarations[#AbstractC], |
71 [false, false, false, false, true]); | 71 [false, false, false, false, true]); |
72 checkKinds(classMirror.members[#bar], | 72 checkKinds(classMirror.declarations[#bar], |
73 [false, true, false, false, false]); | 73 [false, true, false, false, false]); |
74 checkKinds(classMirror.members[#priv], | 74 checkKinds(classMirror.declarations[#priv], |
75 [false, true, true, false, false]); | 75 [false, true, true, false, false]); |
76 checkKinds(classMirror.members[const Symbol("priv=")], | 76 checkKinds(classMirror.declarations[const Symbol("priv=")], |
77 [false, true, false, true, false]); | 77 [false, true, false, true, false]); |
78 } | 78 } |
OLD | NEW |