Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: tests/compiler/dart2js/mirrors_used_test.dart

Issue 1226733010: dart2js: Remove oldEmitter field in emitter-task. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = expectedNames.map(backend.namer.asName).toList();
90 expectedNames.addAll(nativeNames); 90 expectedNames.addAll(nativeNames);
91 91
92 // Mirrors only work in the full emitter. We can thus be certain that the
93 // emitter is the full emitter.
94 OldEmitter fullEmitter = backend.emitter.emitter;
92 Set recordedNames = new Set() 95 Set recordedNames = new Set()
93 ..addAll(backend.emitter.oldEmitter.recordedMangledNames) 96 ..addAll(fullEmitter.recordedMangledNames)
94 ..addAll(backend.emitter.oldEmitter.mangledFieldNames.keys) 97 ..addAll(fullEmitter.mangledFieldNames.keys)
95 ..addAll(backend.emitter.oldEmitter.mangledGlobalFieldNames.keys); 98 ..addAll(fullEmitter.mangledGlobalFieldNames.keys);
96 Expect.setEquals(new Set.from(expectedNames), recordedNames); 99 Expect.setEquals(new Set.from(expectedNames), recordedNames);
97 100
98 for (var library in compiler.libraryLoader.libraries) { 101 for (var library in compiler.libraryLoader.libraries) {
99 library.forEachLocalMember((member) { 102 library.forEachLocalMember((member) {
100 if (library == compiler.mainApp && member.name == 'Foo') { 103 if (library == compiler.mainApp && member.name == 'Foo') {
101 Expect.isTrue( 104 Expect.isTrue(
102 compiler.backend.isAccessibleByReflection(member), '$member'); 105 compiler.backend.isAccessibleByReflection(member), '$member');
103 member.forEachLocalMember((classMember) { 106 member.forEachLocalMember((classMember) {
104 Expect.isTrue( 107 Expect.isTrue(
105 compiler.backend.isAccessibleByReflection(classMember), 108 compiler.backend.isAccessibleByReflection(classMember),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 library lib; 169 library lib;
167 170
168 import 'dart:mirrors'; 171 import 'dart:mirrors';
169 172
170 useReflect(type) { 173 useReflect(type) {
171 print(new Symbol('Foo')); 174 print(new Symbol('Foo'));
172 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 175 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
173 } 176 }
174 """, 177 """,
175 }; 178 };
OLDNEW
« no previous file with comments | « pkg/dart2js_incremental/lib/library_updater.dart ('k') | tests/compiler/dart2js/source_mapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698