| 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<ClassElement>> subtypes; | 9 final Map<ClassElement, Set<ClassElement>> subtypes; |
| 10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; | 10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 compiler.resolverWorld.isChecks.forEach((DartType type) { | 84 compiler.resolverWorld.isChecks.forEach((DartType type) { |
| 85 if (type is InterfaceType) { | 85 if (type is InterfaceType) { |
| 86 InterfaceType itf = type; | 86 InterfaceType itf = type; |
| 87 if (!itf.isRaw) { | 87 if (!itf.isRaw) { |
| 88 potentiallyAddForRti(itf.element); | 88 potentiallyAddForRti(itf.element); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 }); | 91 }); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool needsRti(ClassElement cls) { | |
| 95 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; | |
| 96 } | |
| 97 | |
| 98 void registerMixinUse(MixinApplicationElement mixinApplication, | 94 void registerMixinUse(MixinApplicationElement mixinApplication, |
| 99 ClassElement mixin) { | 95 ClassElement mixin) { |
| 100 Set<MixinApplicationElement> users = | 96 Set<MixinApplicationElement> users = |
| 101 mixinUses.putIfAbsent(mixin, () => | 97 mixinUses.putIfAbsent(mixin, () => |
| 102 new Set<MixinApplicationElement>()); | 98 new Set<MixinApplicationElement>()); |
| 103 users.add(mixinApplication); | 99 users.add(mixinApplication); |
| 104 } | 100 } |
| 105 | 101 |
| 102 bool isUsedAsMixin(ClassElement cls) { |
| 103 Set<MixinApplicationElement> uses = mixinUses[cls]; |
| 104 return uses != null && !uses.isEmpty; |
| 105 } |
| 106 |
| 107 |
| 106 void registerRtiDependency(Element element, Element dependency) { | 108 void registerRtiDependency(Element element, Element dependency) { |
| 107 // We're not dealing with typedef for now. | 109 // We're not dealing with typedef for now. |
| 108 if (!element.isClass() || !dependency.isClass()) return; | 110 if (!element.isClass() || !dependency.isClass()) return; |
| 109 Set<ClassElement> classes = | 111 Set<ClassElement> classes = |
| 110 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); | 112 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); |
| 111 classes.add(dependency); | 113 classes.add(dependency); |
| 112 } | 114 } |
| 113 | 115 |
| 116 bool needsRti(ClassElement cls) { |
| 117 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; |
| 118 } |
| 119 |
| 114 void recordUserDefinedGetter(Element element) { | 120 void recordUserDefinedGetter(Element element) { |
| 115 assert(element.isGetter()); | 121 assert(element.isGetter()); |
| 116 userDefinedGetters.add(element); | 122 userDefinedGetters.add(element); |
| 117 } | 123 } |
| 118 | 124 |
| 119 void recordUserDefinedSetter(Element element) { | 125 void recordUserDefinedSetter(Element element) { |
| 120 assert(element.isSetter()); | 126 assert(element.isSetter()); |
| 121 userDefinedSetters.add(element); | 127 userDefinedSetters.add(element); |
| 122 } | 128 } |
| 123 | 129 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 final SourceString name; | 229 final SourceString name; |
| 224 | 230 |
| 225 MemberSet(SourceString this.name) : elements = new Set<Element>(); | 231 MemberSet(SourceString this.name) : elements = new Set<Element>(); |
| 226 | 232 |
| 227 void add(Element element) { | 233 void add(Element element) { |
| 228 elements.add(element); | 234 elements.add(element); |
| 229 } | 235 } |
| 230 | 236 |
| 231 bool get isEmpty => elements.isEmpty; | 237 bool get isEmpty => elements.isEmpty; |
| 232 } | 238 } |
| OLD | NEW |