| 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 17 matching lines...) Expand all Loading... |
| 28 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { | 28 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { |
| 29 if (kind.name == 'verbose info') { | 29 if (kind.name == 'verbose info') { |
| 30 print(message); | 30 print(message); |
| 31 return; | 31 return; |
| 32 } | 32 } |
| 33 if (message.contains('methods retained for use by dart:mirrors out of')) { | 33 if (message.contains('methods retained for use by dart:mirrors out of')) { |
| 34 print(message); | 34 print(message); |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 if (kind.name == 'info') return; | 37 if (kind.name == 'info') return; |
| 38 |
| 39 // TODO(aprelev@gmail.com): Remove once dartbug.com/13907 is fixed. |
| 40 if (message.contains("'typedef' keyword in mixin " |
| 41 "applications was deprecated")) return; |
| 42 |
| 38 throw '$uri:$begin:$end: $kind: $message'; | 43 throw '$uri:$begin:$end: $kind: $message'; |
| 39 } | 44 } |
| 40 | 45 |
| 41 void main() { | 46 void main() { |
| 42 Compiler compiler = compilerFor( | 47 Compiler compiler = compilerFor( |
| 43 MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo); | 48 MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo); |
| 44 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | 49 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { |
| 45 print(''); | 50 print(''); |
| 46 List generatedCode = | 51 List generatedCode = |
| 47 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); | 52 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 library lib; | 148 library lib; |
| 144 | 149 |
| 145 import 'dart:mirrors'; | 150 import 'dart:mirrors'; |
| 146 | 151 |
| 147 useReflect(type) { | 152 useReflect(type) { |
| 148 print(new Symbol('Foo')); | 153 print(new Symbol('Foo')); |
| 149 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 154 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
| 150 } | 155 } |
| 151 """, | 156 """, |
| 152 }; | 157 }; |
| OLD | NEW |