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

Unified Diff: sdk/lib/_internal/compiler/implementation/deferred_load.dart

Issue 22067002: Ignore unused classes when constructing set for deferred loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/deferred/deferred_unused_classes_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
index 53eca9743ed7c90cbebcf36cd64e57b6d68b5c56..c6054a8823c0d138fc49ce28bfce45b4e6bf6d9b 100644
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
@@ -153,22 +153,25 @@ class DeferredLoadTask extends CompilerTask {
// If we see a class, add everything its instance members refer
// to. Static members are not relevant.
ClassElement cls = element.declaration;
- cls.forEachLocalMember((Element e) {
- if (!e.isInstanceMember()) return;
- result.addAll(DependencyCollector.collect(e.implementation, compiler));
- });
- if (cls.implementation != cls) {
- // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this?
- cls.implementation.forEachLocalMember((Element e) {
+ // Make sure that class has been used - type has been computed.
+ if (cls.thisType != null) {
ahe 2013/08/06 16:00:34 I think this check belongs on line 92, and it feel
aam-me 2013/08/07 03:20:42 Thanks, makes sense. Done.
+ cls.forEachLocalMember((Element e) {
if (!e.isInstanceMember()) return;
- result.addAll(DependencyCollector.collect(e.implementation,
- compiler));
+ result.addAll(DependencyCollector.collect(e.implementation, compiler));
});
+ if (cls.implementation != cls) {
+ // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this?
+ cls.implementation.forEachLocalMember((Element e) {
+ if (!e.isInstanceMember()) return;
+ result.addAll(DependencyCollector.collect(e.implementation,
+ compiler));
+ });
+ }
+ for (var type in cls.allSupertypes) {
+ result.add(type.element.implementation);
+ }
+ result.add(cls.implementation);
}
- for (var type in cls.allSupertypes) {
- result.add(type.element.implementation);
- }
- result.add(cls.implementation);
} else if (Elements.isStaticOrTopLevel(element)
|| element.isConstructor()) {
result.addAll(DependencyCollector.collect(element, compiler));
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/deferred/deferred_unused_classes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698