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 /// Test that the @MirrorsUsed annotation suppress hints and that only | 5 /// Test that the @MirrorsUsed annotation suppress hints and that only |
6 /// requested elements are retained for reflection. | 6 /// requested elements are retained for reflection. |
7 library dart2js.test.mirrors_used_test; | 7 library dart2js.test.mirrors_used_test; |
8 | 8 |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
(...skipping 27 matching lines...) Expand all Loading... |
38 if (kind.name == 'info') return; | 38 if (kind.name == 'info') return; |
39 | 39 |
40 // TODO(aprelev@gmail.com): Remove once dartbug.com/13907 is fixed. | 40 // TODO(aprelev@gmail.com): Remove once dartbug.com/13907 is fixed. |
41 if (message.contains("Warning: 'typedef' not allowed here")) return; | 41 if (message.contains("Warning: 'typedef' not allowed here")) return; |
42 | 42 |
43 throw '$uri:$begin:$end: $kind: $message'; | 43 throw '$uri:$begin:$end: $kind: $message'; |
44 } | 44 } |
45 | 45 |
46 void main() { | 46 void main() { |
47 Compiler compiler = compilerFor( | 47 Compiler compiler = compilerFor( |
48 MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo); | 48 MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo, |
| 49 options: ['--enable-experimental-mirrors']); |
49 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | 50 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { |
50 print(''); | 51 print(''); |
51 List generatedCode = | 52 List generatedCode = |
52 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); | 53 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); |
53 for (var element in generatedCode) { | 54 for (var element in generatedCode) { |
54 print(element); | 55 print(element); |
55 } | 56 } |
56 print(''); | 57 print(''); |
57 | 58 |
58 // This assertion can fail for two reasons: | 59 // This assertion can fail for two reasons: |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 library lib; | 166 library lib; |
166 | 167 |
167 import 'dart:mirrors'; | 168 import 'dart:mirrors'; |
168 | 169 |
169 useReflect(type) { | 170 useReflect(type) { |
170 print(new Symbol('Foo')); | 171 print(new Symbol('Foo')); |
171 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 172 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
172 } | 173 } |
173 """, | 174 """, |
174 }; | 175 }; |
OLD | NEW |