| 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 runCompiler; | 12 import 'memory_compiler.dart' show runCompiler; |
| 13 | 13 |
| 14 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; | 14 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; |
| 15 | 15 |
| 16 import 'package:compiler/src/constants/values.dart' | 16 import 'package:compiler/src/constants/values.dart' |
| 17 show ConstantValue, TypeConstantValue; | 17 show ConstantValue, TypeConstantValue; |
| 18 | 18 |
| 19 import 'package:compiler/src/elements/elements.dart' show Element, Elements; | 19 import 'package:compiler/src/elements/elements.dart' |
| 20 show ClassElement, Elements; |
| 20 | 21 |
| 21 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend; | 22 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend; |
| 22 import 'package:compiler/src/js_backend/mirrors_analysis.dart'; | 23 import 'package:compiler/src/js_backend/mirrors_analysis.dart'; |
| 23 | 24 |
| 24 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full | 25 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full |
| 25 show Emitter; | 26 show Emitter; |
| 26 | 27 |
| 27 import 'package:compiler/src/old_to_new_api.dart' | 28 import 'package:compiler/src/old_to_new_api.dart' |
| 28 show LegacyCompilerDiagnostics; | 29 show LegacyCompilerDiagnostics; |
| 29 | 30 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 r'get$field' | 79 r'get$field' |
| 79 ]; // The (getter) name of Foo.field. | 80 ]; // The (getter) name of Foo.field. |
| 80 // TODO(ahe): Check for the following names, currently they are not being | 81 // TODO(ahe): Check for the following names, currently they are not being |
| 81 // recorded correctly, but are being emitted. | 82 // recorded correctly, but are being emitted. |
| 82 [ | 83 [ |
| 83 'Foo_staticMethod', // The name of Foo.staticMethod. | 84 'Foo_staticMethod', // The name of Foo.staticMethod. |
| 84 r'instanceMethod$0' | 85 r'instanceMethod$0' |
| 85 ]; // The name of Foo.instanceMethod. | 86 ]; // The name of Foo.instanceMethod. |
| 86 | 87 |
| 87 // We always include the names of some native classes. | 88 // We always include the names of some native classes. |
| 88 List<Element> nativeClasses = [ | 89 List<ClassElement> nativeClasses = [ |
| 89 compiler.commonElements.intClass, | 90 compiler.commonElements.intClass, |
| 90 compiler.commonElements.doubleClass, | 91 compiler.commonElements.doubleClass, |
| 91 compiler.commonElements.numClass, | 92 compiler.commonElements.numClass, |
| 92 compiler.commonElements.stringClass, | 93 compiler.commonElements.stringClass, |
| 93 compiler.commonElements.boolClass, | 94 compiler.commonElements.boolClass, |
| 94 compiler.commonElements.nullClass, | 95 compiler.commonElements.nullClass, |
| 95 compiler.commonElements.listClass | 96 compiler.commonElements.listClass |
| 96 ]; | 97 ]; |
| 97 Iterable<String> nativeNames = nativeClasses.map(backend.namer.className); | 98 Iterable<String> nativeNames = nativeClasses.map(backend.namer.className); |
| 98 expectedNames = expectedNames.map(backend.namer.asName).toList(); | 99 expectedNames = expectedNames.map(backend.namer.asName).toList(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 library lib; | 201 library lib; |
| 201 | 202 |
| 202 import 'dart:mirrors'; | 203 import 'dart:mirrors'; |
| 203 | 204 |
| 204 useReflect(type) { | 205 useReflect(type) { |
| 205 print(new Symbol('Foo')); | 206 print(new Symbol('Foo')); |
| 206 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 207 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
| 207 } | 208 } |
| 208 """, | 209 """, |
| 209 }; | 210 }; |
| OLD | NEW |