Chromium Code Reviews| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Returns whether a subclass of [superclass] mixes in [other]. | 131 // Returns whether a subclass of [superclass] mixes in [other]. |
| 132 bool hasAnySubclassThatMixes(ClassElement superclass, ClassElement other) { | 132 bool hasAnySubclassThatMixes(ClassElement superclass, ClassElement other) { |
| 133 Set<MixinApplicationElement> uses = mixinUses[other]; | 133 Set<MixinApplicationElement> uses = mixinUses[other]; |
| 134 return (uses != null) | 134 return (uses != null) |
| 135 ? uses.any((each) => each.isSubclassOf(superclass)) | 135 ? uses.any((each) => each.isSubclassOf(superclass)) |
| 136 : false; | 136 : false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Returns whether a superclass of [cls] mixes in [other]. | |
|
kasperl
2013/04/29 10:27:21
Get rid of this helper again?
ngeoffray
2013/04/29 10:37:48
Done.
| |
| 140 bool hasAnySuperclassThatMixes(ClassElement cls, ClassElement other) { | |
| 141 Set<MixinApplicationElement> uses = mixinUses[other]; | |
| 142 return (uses != null) | |
| 143 ? uses.any((each) => cls.isSubclassOf(each)) | |
| 144 : false; | |
| 145 } | |
| 146 | |
| 139 void registerUsedElement(Element element) { | 147 void registerUsedElement(Element element) { |
| 140 if (element.isInstanceMember() && !element.isAbstract(compiler)) { | 148 if (element.isInstanceMember() && !element.isAbstract(compiler)) { |
| 141 allFunctions.add(element); | 149 allFunctions.add(element); |
| 142 } | 150 } |
| 143 } | 151 } |
| 144 | 152 |
| 145 VariableElement locateSingleField(Selector selector) { | 153 VariableElement locateSingleField(Selector selector) { |
| 146 Element result = locateSingleElement(selector); | 154 Element result = locateSingleElement(selector); |
| 147 return (result != null && result.isField()) ? result : null; | 155 return (result != null && result.isField()) ? result : null; |
| 148 } | 156 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 } | 191 } |
| 184 | 192 |
| 185 void addFunctionCalledInLoop(Element element) { | 193 void addFunctionCalledInLoop(Element element) { |
| 186 functionsCalledInLoop.add(element); | 194 functionsCalledInLoop.add(element); |
| 187 } | 195 } |
| 188 | 196 |
| 189 bool isCalledInLoop(Element element) { | 197 bool isCalledInLoop(Element element) { |
| 190 return functionsCalledInLoop.contains(element); | 198 return functionsCalledInLoop.contains(element); |
| 191 } | 199 } |
| 192 } | 200 } |
| OLD | NEW |