| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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; | 5 part of dart2js; |
| 6 | 6 |
| 7 class World { | 7 class World { |
| 8 final Compiler compiler; | 8 final Compiler compiler; |
| 9 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; | 9 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; |
| 10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; | 10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 mixinUses.putIfAbsent(mixin, () => | 154 mixinUses.putIfAbsent(mixin, () => |
| 155 new Set<MixinApplicationElement>()); | 155 new Set<MixinApplicationElement>()); |
| 156 users.add(mixinApplication); | 156 users.add(mixinApplication); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool isUsedAsMixin(ClassElement cls) { | 159 bool isUsedAsMixin(ClassElement cls) { |
| 160 Set<MixinApplicationElement> uses = mixinUses[cls]; | 160 Set<MixinApplicationElement> uses = mixinUses[cls]; |
| 161 return uses != null && !uses.isEmpty; | 161 return uses != null && !uses.isEmpty; |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool hasAnySubclass(ClassElement cls) { |
| 165 Set<ClassElement> classes = subclasses[cls]; |
| 166 return classes != null && !classes.isEmpty; |
| 167 } |
| 168 |
| 169 bool hasAnySubtype(ClassElement cls) { |
| 170 Set<ClassElement> classes = subtypes[cls]; |
| 171 return classes != null && !classes.isEmpty; |
| 172 } |
| 173 |
| 164 void registerRtiDependency(Element element, Element dependency) { | 174 void registerRtiDependency(Element element, Element dependency) { |
| 165 // We're not dealing with typedef for now. | 175 // We're not dealing with typedef for now. |
| 166 if (!element.isClass() || !dependency.isClass()) return; | 176 if (!element.isClass() || !dependency.isClass()) return; |
| 167 Set<ClassElement> classes = | 177 Set<ClassElement> classes = |
| 168 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); | 178 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); |
| 169 classes.add(dependency); | 179 classes.add(dependency); |
| 170 } | 180 } |
| 171 | 181 |
| 172 bool needsRti(ClassElement cls) { | 182 bool needsRti(ClassElement cls) { |
| 173 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; | 183 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (mask != null) { | 240 if (mask != null) { |
| 231 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector); | 241 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector); |
| 232 } | 242 } |
| 233 ClassElement objectClass = compiler.objectClass; | 243 ClassElement objectClass = compiler.objectClass; |
| 234 return allFunctions | 244 return allFunctions |
| 235 .filter(noSuchMethodSelector) | 245 .filter(noSuchMethodSelector) |
| 236 .map((Element member) => member.getEnclosingClass()) | 246 .map((Element member) => member.getEnclosingClass()) |
| 237 .where((ClassElement holder) => !identical(holder, objectClass)); | 247 .where((ClassElement holder) => !identical(holder, objectClass)); |
| 238 } | 248 } |
| 239 } | 249 } |
| OLD | NEW |