| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 = nativeClasses.map(backend.namer.className); | 88     Iterable<String> nativeNames = nativeClasses.map(backend.namer.className); | 
|  | 89     expectedNames = expectedNames.map(backend.namer.asName).toList(); | 
| 89     expectedNames.addAll(nativeNames); | 90     expectedNames.addAll(nativeNames); | 
| 90 | 91 | 
| 91     Set recordedNames = new Set() | 92     Set recordedNames = new Set() | 
| 92         ..addAll(backend.emitter.oldEmitter.recordedMangledNames) | 93         ..addAll(backend.emitter.oldEmitter.recordedMangledNames) | 
| 93         ..addAll(backend.emitter.oldEmitter.mangledFieldNames.keys) | 94         ..addAll(backend.emitter.oldEmitter.mangledFieldNames.keys) | 
| 94         ..addAll(backend.emitter.oldEmitter.mangledGlobalFieldNames.keys); | 95         ..addAll(backend.emitter.oldEmitter.mangledGlobalFieldNames.keys); | 
| 95     Expect.setEquals(new Set.from(expectedNames), recordedNames); | 96     Expect.setEquals(new Set.from(expectedNames), recordedNames); | 
| 96 | 97 | 
| 97     for (var library in compiler.libraryLoader.libraries) { | 98     for (var library in compiler.libraryLoader.libraries) { | 
| 98       library.forEachLocalMember((member) { | 99       library.forEachLocalMember((member) { | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 165 library lib; | 166 library lib; | 
| 166 | 167 | 
| 167 import 'dart:mirrors'; | 168 import 'dart:mirrors'; | 
| 168 | 169 | 
| 169 useReflect(type) { | 170 useReflect(type) { | 
| 170   print(new Symbol('Foo')); | 171   print(new Symbol('Foo')); | 
| 171   print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 172   print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); | 
| 172 } | 173 } | 
| 173 """, | 174 """, | 
| 174 }; | 175 }; | 
| OLD | NEW | 
|---|