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

Side by Side Diff: dart/tests/try/poi/forget_element_test.dart

Issue 626433004: Forget closure classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r40894 Created 6 years, 2 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
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/enqueue.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 of Compiler.forgetElement. 5 // Test of Compiler.forgetElement.
6 library trydart.forget_element_test; 6 library trydart.forget_element_test;
7 7
8 import 'package:compiler/implementation/elements/elements.dart' show 8 import 'package:compiler/implementation/elements/elements.dart' show
9 AstElement, 9 AstElement,
10 ClassElement, 10 ClassElement,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 Expect.isTrue( 152 Expect.isTrue(
153 codegenTypesIn(library).isEmpty, 'codegen instantiatedTypes'); 153 codegenTypesIn(library).isEmpty, 'codegen instantiatedTypes');
154 Expect.isTrue( 154 Expect.isTrue(
155 codegenClassesIn(library).isEmpty, 'codegen instantiatedClasses'); 155 codegenClassesIn(library).isEmpty, 'codegen instantiatedClasses');
156 156
157 // Check that other members remembered by [Universe] were forgotten. 157 // Check that other members remembered by [Universe] were forgotten.
158 Expect.isTrue( 158 Expect.isTrue(
159 resolutionMembersIn(library).isEmpty, 'resolution misc members'); 159 resolutionMembersIn(library).isEmpty, 'resolution misc members');
160 Expect.isTrue( 160 Expect.isTrue(
161 codegenMembersIn(library).isEmpty, 'codegen misc members'); 161 codegenMembersIn(library).isEmpty, 'codegen misc members');
162
163 // Check that classes remembered by the enqueuer have been forgotten.
164 Expect.isTrue(
165 codegenSeenClassesIn(library).isEmpty, 'codegen seen classes');
166 Expect.isTrue(
167 resolutionSeenClassesIn(library).isEmpty, 'resolution seen classes');
162 }); 168 });
163 169
164 Iterable closuresInLibrary(LibraryElement library) { 170 Iterable closuresInLibrary(LibraryElement library) {
165 return compiler.enqueuer.resolution.universe.allClosures.where( 171 return compiler.enqueuer.resolution.universe.allClosures.where(
166 (LocalFunctionElement closure) => closure.library == library); 172 (LocalFunctionElement closure) => closure.library == library);
167 } 173 }
168 174
169 Iterable metadataInLibrary(LibraryElement library) { 175 Iterable metadataInLibrary(LibraryElement library) {
170 return backend.constants.metadataConstantMap.keys.where( 176 return backend.constants.metadataConstantMap.keys.where(
171 (MetadataAnnotation metadata) { 177 (MetadataAnnotation metadata) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 (ClassElement cls) => cls.library == library); 251 (ClassElement cls) => cls.library == library);
246 } 252 }
247 253
248 Iterable resolutionMembersIn(LibraryElement library) { 254 Iterable resolutionMembersIn(LibraryElement library) {
249 sameLibrary(e) => e.library == library; 255 sameLibrary(e) => e.library == library;
250 return new Set() 256 return new Set()
251 ..addAll(resolutionUniverse.closurizedMembers.where(sameLibrary)) 257 ..addAll(resolutionUniverse.closurizedMembers.where(sameLibrary))
252 ..addAll(resolutionUniverse.fieldSetters.where(sameLibrary)) 258 ..addAll(resolutionUniverse.fieldSetters.where(sameLibrary))
253 ..addAll(resolutionUniverse.fieldGetters.where(sameLibrary)); 259 ..addAll(resolutionUniverse.fieldGetters.where(sameLibrary));
254 } 260 }
261
262 Iterable codegenSeenClassesIn(LibraryElement library) {
263 return compiler.enqueuer.codegen.seenClasses.where(
264 (e) => e.library == library);
265 }
266
267 Iterable resolutionSeenClassesIn(LibraryElement library) {
268 return compiler.enqueuer.resolution.seenClasses.where(
269 (e) => e.library == library);
270 }
255 } 271 }
256 272
257 class NodeCollector extends tree.Visitor { 273 class NodeCollector extends tree.Visitor {
258 final List<tree.Node> nodes = <tree.Node>[]; 274 final List<tree.Node> nodes = <tree.Node>[];
259 275
260 void visitNode(tree.Node node) { 276 void visitNode(tree.Node node) {
261 nodes.add(node); 277 nodes.add(node);
262 node.visitChildren(this); 278 node.visitChildren(this);
263 } 279 }
264 } 280 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Test that a constant in a parameter initializer is discarded 394 // Test that a constant in a parameter initializer is discarded
379 // correctly (deeply nested function). 395 // correctly (deeply nested function).
380 new ForgetElementTestCase( 396 new ForgetElementTestCase(
381 'main() => (() => (([x = const Constant()]) => x)())();' 397 'main() => (() => (([x = const Constant()]) => x)())();'
382 ' $CONSTANT_CLASS', 398 ' $CONSTANT_CLASS',
383 closureCount: 2, 399 closureCount: 2,
384 constantCount: 1, 400 constantCount: 1,
385 initialValueCount: 1), 401 initialValueCount: 1),
386 402
387 ]..addAll(assertUnimplementedLocalMetadata()); 403 ]..addAll(assertUnimplementedLocalMetadata());
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/enqueue.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698