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 17 matching lines...) Expand all Loading... |
28 C(); | 28 C(); |
29 C.other(); | 29 C.other(); |
30 C.other2() : this.other(); | 30 C.other2() : this.other(); |
31 | 31 |
32 var _priv; | 32 var _priv; |
33 get priv => _priv; | 33 get priv => _priv; |
34 set priv(value) => _priv = value; | 34 set priv(value) => _priv = value; |
35 } | 35 } |
36 | 36 |
37 checkKinds(method, kinds) { | 37 checkKinds(method, kinds) { |
38 Expect.equals(method.isStatic, kinds[0]); | 38 Expect.equals(kinds[0], method.isStatic, "isStatic"); |
39 Expect.equals(method.isAbstract, kinds[1]); | 39 Expect.equals(kinds[1], method.isAbstract, "isAbstract"); |
40 Expect.equals(method.isGetter, kinds[2]); | 40 Expect.equals(kinds[2], method.isGetter, "isGetter"); |
41 Expect.equals(method.isSetter, kinds[3]); | 41 Expect.equals(kinds[3], method.isSetter, "isSetter"); |
42 Expect.equals(method.isConstructor, kinds[4]); | 42 Expect.equals(kinds[4], method.isConstructor, "isConstructor"); |
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.declarations[#topGetter], | 51 checkKinds(libraryMirror.declarations[#topGetter], |
52 [true, false, true, false, false]); | 52 [true, false, true, false, false]); |
(...skipping 16 matching lines...) Expand all Loading... |
69 classMirror = reflectClass(AbstractC); | 69 classMirror = reflectClass(AbstractC); |
70 checkKinds(classMirror.declarations[#AbstractC], | 70 checkKinds(classMirror.declarations[#AbstractC], |
71 [false, false, false, false, true]); | 71 [false, false, false, false, true]); |
72 checkKinds(classMirror.declarations[#bar], | 72 checkKinds(classMirror.declarations[#bar], |
73 [false, true, false, false, false]); | 73 [false, true, false, false, false]); |
74 checkKinds(classMirror.declarations[#priv], | 74 checkKinds(classMirror.declarations[#priv], |
75 [false, true, true, false, false]); | 75 [false, true, true, false, false]); |
76 checkKinds(classMirror.declarations[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 |