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"; |
11 | 11 |
12 import 'memory_compiler.dart' show | 12 import 'memory_compiler.dart' show |
13 compilerFor; | 13 compilerFor; |
14 | 14 |
15 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show | 15 import 'package:compiler/implementation/apiimpl.dart' show |
16 Compiler; | 16 Compiler; |
17 | 17 |
18 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show | 18 import 'package:compiler/implementation/dart2jslib.dart' show |
19 Constant, | 19 Constant, |
20 TypeConstant; | 20 TypeConstant; |
21 | 21 |
22 import | 22 import 'package:compiler/implementation/elements/elements.dart' show |
23 '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart' | 23 Element, |
24 show Element, Elements; | 24 Elements; |
25 import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend
.dart' | 25 |
26 show JavaScriptBackend; | 26 import 'package:compiler/implementation/js_backend/js_backend.dart' show |
| 27 JavaScriptBackend; |
27 | 28 |
28 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { | 29 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { |
29 if (kind.name == 'verbose info') { | 30 if (kind.name == 'verbose info') { |
30 print(message); | 31 print(message); |
31 return; | 32 return; |
32 } | 33 } |
33 if (message.contains('methods retained for use by dart:mirrors out of')) { | 34 if (message.contains('methods retained for use by dart:mirrors out of')) { |
34 print(message); | 35 print(message); |
35 return; | 36 return; |
36 } | 37 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 library lib; | 163 library lib; |
163 | 164 |
164 import 'dart:mirrors'; | 165 import 'dart:mirrors'; |
165 | 166 |
166 useReflect(type) { | 167 useReflect(type) { |
167 print(new Symbol('Foo')); | 168 print(new Symbol('Foo')); |
168 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 169 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
169 } | 170 } |
170 """, | 171 """, |
171 }; | 172 }; |
OLD | NEW |