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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 void main() { | 52 void main() { |
53 asyncTest(() async { | 53 asyncTest(() async { |
54 var result = await runCompiler( | 54 var result = await runCompiler( |
55 memorySourceFiles: MEMORY_SOURCE_FILES, | 55 memorySourceFiles: MEMORY_SOURCE_FILES, |
56 diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo), | 56 diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo), |
57 options: ['--enable-experimental-mirrors']); | 57 options: ['--enable-experimental-mirrors']); |
58 CompilerImpl compiler = result.compiler; | 58 CompilerImpl compiler = result.compiler; |
59 print(''); | 59 print(''); |
60 List generatedCode = | 60 List generatedCode = |
61 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); | 61 Elements.sortedByPosition(compiler.enqueuer.codegen.processedEntities); |
62 for (var element in generatedCode) { | 62 for (var element in generatedCode) { |
63 print(element); | 63 print(element); |
64 } | 64 } |
65 print(''); | 65 print(''); |
66 | 66 |
67 // This assertion can fail for two reasons: | 67 // This assertion can fail for two reasons: |
68 // 1. Too many elements retained for reflection. | 68 // 1. Too many elements retained for reflection. |
69 // 2. Some code was refactored, and there are more methods. | 69 // 2. Some code was refactored, and there are more methods. |
70 // Either situation could be problematic, but in situation 2, it is often | 70 // Either situation could be problematic, but in situation 2, it is often |
71 // acceptable to increase [expectedMethodCount] a little. | 71 // acceptable to increase [expectedMethodCount] a little. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 library lib; | 185 library lib; |
186 | 186 |
187 import 'dart:mirrors'; | 187 import 'dart:mirrors'; |
188 | 188 |
189 useReflect(type) { | 189 useReflect(type) { |
190 print(new Symbol('Foo')); | 190 print(new Symbol('Foo')); |
191 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 191 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
192 } | 192 } |
193 """, | 193 """, |
194 }; | 194 }; |
OLD | NEW |