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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/program_builder/collector.dart

Issue 2934783002: Handle named mixin application in emitter (Closed)
Patch Set: Fixes Created 3 years, 6 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.js_emitter.program_builder; 5 part of dart2js.js_emitter.program_builder;
6 6
7 /** 7 /**
8 * Generates the code for all used classes in the program. Static fields (even 8 * Generates the code for all used classes in the program. Static fields (even
9 * in classes) are ignored, since they can be treated as non-class elements. 9 * in classes) are ignored, since they can be treated as non-class elements.
10 * 10 *
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void addClassesWithSuperclasses(Iterable<ClassEntity> classes) { 222 void addClassesWithSuperclasses(Iterable<ClassEntity> classes) {
223 for (ClassEntity cls in classes) { 223 for (ClassEntity cls in classes) {
224 addClassWithSuperclasses(cls); 224 addClassWithSuperclasses(cls);
225 } 225 }
226 } 226 }
227 227
228 // 1. We need to generate all classes that are instantiated. 228 // 1. We need to generate all classes that are instantiated.
229 addClassesWithSuperclasses(instantiatedClasses); 229 addClassesWithSuperclasses(instantiatedClasses);
230 230
231 // 2. Add all classes used as mixins. 231 // 2. Add all classes used as mixins.
232 Set<ClassEntity> mixinClasses = new Set<ClassEntity>(); 232 Set<ClassEntity> mixinClasses = neededClasses
233 for (ClassEntity cls in neededClasses) { 233 .where(_elementEnvironment.isMixinApplication)
234 _elementEnvironment.forEachMixin(cls, (ClassEntity mixinClass) { 234 .map(_elementEnvironment.getEffectiveMixinClass)
235 mixinClasses.add(mixinClass); 235 .toSet();
236 });
237 }
238 neededClasses.addAll(mixinClasses); 236 neededClasses.addAll(mixinClasses);
239 237
240 // 3. Find all classes needed for rti. 238 // 3. Find all classes needed for rti.
241 // It is important that this is the penultimate step, at this point, 239 // It is important that this is the penultimate step, at this point,
242 // neededClasses must only contain classes that have been resolved and 240 // neededClasses must only contain classes that have been resolved and
243 // codegen'd. The rtiNeededClasses may contain additional classes, but 241 // codegen'd. The rtiNeededClasses may contain additional classes, but
244 // these are thought to not have been instantiated, so we neeed to be able 242 // these are thought to not have been instantiated, so we neeed to be able
245 // to identify them later and make sure we only emit "empty shells" without 243 // to identify them later and make sure we only emit "empty shells" without
246 // fields, etc. 244 // fields, etc.
247 classesOnlyNeededForRti = new Set<ClassElement>(); 245 classesOnlyNeededForRti = new Set<ClassElement>();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 355 }
358 356
359 void collect() { 357 void collect() {
360 computeNeededDeclarations(); 358 computeNeededDeclarations();
361 computeNeededConstants(); 359 computeNeededConstants();
362 computeNeededStatics(); 360 computeNeededStatics();
363 computeNeededStaticNonFinalFields(); 361 computeNeededStaticNonFinalFields();
364 computeNeededLibraries(); 362 computeNeededLibraries();
365 } 363 }
366 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698