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

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

Issue 340783011: Take inheritance into account when computing the elements accessible by mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased + fixes Created 6 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 | Annotate | Revision Log
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Set recordedNames = new Set() 91 Set recordedNames = new Set()
92 ..addAll(backend.emitter.recordedMangledNames) 92 ..addAll(backend.emitter.recordedMangledNames)
93 ..addAll(backend.emitter.mangledFieldNames.keys) 93 ..addAll(backend.emitter.mangledFieldNames.keys)
94 ..addAll(backend.emitter.mangledGlobalFieldNames.keys); 94 ..addAll(backend.emitter.mangledGlobalFieldNames.keys);
95 Expect.setEquals(new Set.from(expectedNames), recordedNames); 95 Expect.setEquals(new Set.from(expectedNames), recordedNames);
96 96
97 for (var library in compiler.libraryLoader.libraries) { 97 for (var library in compiler.libraryLoader.libraries) {
98 library.forEachLocalMember((member) { 98 library.forEachLocalMember((member) {
99 if (library == compiler.mainApp && member.name == 'Foo') { 99 if (library == compiler.mainApp && member.name == 'Foo') {
100 Expect.isTrue( 100 Expect.isTrue(
101 compiler.backend.isNeededForReflection(member), '$member'); 101 compiler.backend.isAccessibleByReflection(member), '$member');
102 member.forEachLocalMember((classMember) { 102 member.forEachLocalMember((classMember) {
103 Expect.isTrue( 103 Expect.isTrue(
104 compiler.backend.isNeededForReflection(classMember), 104 compiler.backend.isAccessibleByReflection(classMember),
105 '$classMember'); 105 '$classMember');
106 }); 106 });
107 } else { 107 } else {
108 Expect.isFalse( 108 Expect.isFalse(
109 compiler.backend.isNeededForReflection(member), '$member'); 109 compiler.backend.isAccessibleByReflection(member), '$member');
110 } 110 }
111 }); 111 });
112 } 112 }
113 113
114 // There should at least be one metadata constant: 114 // There should at least be one metadata constant:
115 // 1. The constructed constant for 'MirrorsUsed'. 115 // 1. The constructed constant for 'MirrorsUsed'.
116 Expect.isTrue(backend.metadataConstants.length >= 1); 116 Expect.isTrue(backend.metadataConstants.length >= 1);
117 117
118 Set<Constant> compiledConstants = backend.constants.compiledConstants; 118 Set<Constant> compiledConstants = backend.constants.compiledConstants;
119 // Make sure that most of the metadata constants aren't included in the 119 // Make sure that most of the metadata constants aren't included in the
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 library lib; 163 library lib;
164 164
165 import 'dart:mirrors'; 165 import 'dart:mirrors';
166 166
167 useReflect(type) { 167 useReflect(type) {
168 print(new Symbol('Foo')); 168 print(new Symbol('Foo'));
169 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 169 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
170 } 170 }
171 """, 171 """,
172 }; 172 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mirror_tree_shaking_test.dart ('k') | tests/lib/mirrors/mirrors_used_inheritance_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698