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 @MirrorsUsed(metaTargets: 'X') | 5 @MirrorsUsed(metaTargets: 'X') |
6 import 'dart:mirrors'; | 6 import 'dart:mirrors'; |
7 | 7 |
8 const x = const X(); | 8 const x = const X(); |
| 9 |
9 class X { | 10 class X { |
10 const X(); | 11 const X(); |
11 } | 12 } |
12 | 13 |
13 @x | 14 @x |
14 class Y { | 15 class Y { |
15 foo() => 42; | 16 foo() => 42; |
16 } | 17 } |
17 | 18 |
18 class Z { | 19 class Z { |
(...skipping 11 matching lines...) Expand all Loading... |
30 if (reflect(z).invoke(#bar, []).reflectee != 87) throw 'Wrong Z.bar'; | 31 if (reflect(z).invoke(#bar, []).reflectee != 87) throw 'Wrong Z.bar'; |
31 | 32 |
32 bool caught = false; | 33 bool caught = false; |
33 try { | 34 try { |
34 reflect(z).invoke(#foo, []); | 35 reflect(z).invoke(#foo, []); |
35 } on UnsupportedError catch (e) { | 36 } on UnsupportedError catch (e) { |
36 caught = true; | 37 caught = true; |
37 } | 38 } |
38 if (!caught) throw 'Wrong Z.foo'; | 39 if (!caught) throw 'Wrong Z.foo'; |
39 } | 40 } |
OLD | NEW |