| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 'Foo_staticMethod', // The name of Foo.staticMethod. | 78 'Foo_staticMethod', // The name of Foo.staticMethod. |
| 79 r'instanceMethod$0']; // The name of Foo.instanceMethod. | 79 r'instanceMethod$0']; // The name of Foo.instanceMethod. |
| 80 | 80 |
| 81 // We always include the names of some native classes. | 81 // We always include the names of some native classes. |
| 82 List<Element> nativeClasses = [ | 82 List<Element> nativeClasses = [ |
| 83 compiler.intClass, compiler.doubleClass, compiler.numClass, | 83 compiler.intClass, compiler.doubleClass, compiler.numClass, |
| 84 compiler.stringClass, compiler.boolClass, compiler.nullClass, | 84 compiler.stringClass, compiler.boolClass, compiler.nullClass, |
| 85 compiler.listClass | 85 compiler.listClass |
| 86 ]; | 86 ]; |
| 87 JavaScriptBackend backend = compiler.backend; | 87 JavaScriptBackend backend = compiler.backend; |
| 88 Iterable<String> nativeNames = | 88 Iterable<String> nativeNames = nativeClasses.map(backend.namer.className); |
| 89 nativeClasses.map(backend.namer.getNameOfClass); | |
| 90 expectedNames.addAll(nativeNames); | 89 expectedNames.addAll(nativeNames); |
| 91 | 90 |
| 92 Set recordedNames = new Set() | 91 Set recordedNames = new Set() |
| 93 ..addAll(backend.emitter.oldEmitter.recordedMangledNames) | 92 ..addAll(backend.emitter.oldEmitter.recordedMangledNames) |
| 94 ..addAll(backend.emitter.oldEmitter.mangledFieldNames.keys) | 93 ..addAll(backend.emitter.oldEmitter.mangledFieldNames.keys) |
| 95 ..addAll(backend.emitter.oldEmitter.mangledGlobalFieldNames.keys); | 94 ..addAll(backend.emitter.oldEmitter.mangledGlobalFieldNames.keys); |
| 96 Expect.setEquals(new Set.from(expectedNames), recordedNames); | 95 Expect.setEquals(new Set.from(expectedNames), recordedNames); |
| 97 | 96 |
| 98 for (var library in compiler.libraryLoader.libraries) { | 97 for (var library in compiler.libraryLoader.libraries) { |
| 99 library.forEachLocalMember((member) { | 98 library.forEachLocalMember((member) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 library lib; | 165 library lib; |
| 167 | 166 |
| 168 import 'dart:mirrors'; | 167 import 'dart:mirrors'; |
| 169 | 168 |
| 170 useReflect(type) { | 169 useReflect(type) { |
| 171 print(new Symbol('Foo')); | 170 print(new Symbol('Foo')); |
| 172 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 171 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); |
| 173 } | 172 } |
| 174 """, | 173 """, |
| 175 }; | 174 }; |
| OLD | NEW |