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<ClassElement>> subtypes; | 9 final Map<ClassElement, Set<ClassElement>> subtypes; |
| 10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; | 10 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 bool hasAnyUserDefinedGetter(Selector selector) { | 119 bool hasAnyUserDefinedGetter(Selector selector) { |
| 120 return userDefinedGetters.hasAnyElementMatchingSelector(selector); | 120 return userDefinedGetters.hasAnyElementMatchingSelector(selector); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool hasAnyUserDefinedSetter(Selector selector) { | 123 bool hasAnyUserDefinedSetter(Selector selector) { |
| 124 return userDefinedSetters.hasAnyElementMatchingSelector(selector); | 124 return userDefinedSetters.hasAnyElementMatchingSelector(selector); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Returns whether a subclass of [superclass] implements [type]. | 127 // Returns whether a subclass of [superclass] implements [type]. |
| 128 bool hasAnySubclassThatImplements(ClassElement superclass, DartType type) { | 128 bool hasAnySubclassThatImplements(ClassElement superclass, DartType type) { |
| 129 Set<ClassElement> typesImplementedBySubclasses = | 129 Set<ClassElement> types = typesImplementedBySubclasses[superclass]; |
|
ahe
2012/11/22 12:16:23
types -> subclasses?
ngeoffray
2012/11/22 12:19:13
Done.
| |
| 130 typesImplementedBySubclasses[superclass]; | 130 if (types == null) return false; |
| 131 if (typesImplementedBySubclasses == null) return false; | 131 return types.contains(type.element); |
| 132 return typesImplementedBySubclasses.contains(type.element); | |
| 133 } | 132 } |
| 134 | 133 |
| 135 bool hasNoOverridingMember(Element element) { | 134 bool hasNoOverridingMember(Element element) { |
| 136 ClassElement cls = element.getEnclosingClass(); | 135 ClassElement cls = element.getEnclosingClass(); |
| 137 Set<ClassElement> subclasses = compiler.world.subtypes[cls]; | 136 Set<ClassElement> subclasses = compiler.world.subtypes[cls]; |
| 138 // TODO(ngeoffray): Implement the full thing. | 137 // TODO(ngeoffray): Implement the full thing. |
| 139 return subclasses == null || subclasses.isEmpty; | 138 return subclasses == null || subclasses.isEmpty; |
| 140 } | 139 } |
| 141 | 140 |
| 142 | 141 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 final SourceString name; | 220 final SourceString name; |
| 222 | 221 |
| 223 MemberSet(SourceString this.name) : elements = new Set<Element>(); | 222 MemberSet(SourceString this.name) : elements = new Set<Element>(); |
| 224 | 223 |
| 225 void add(Element element) { | 224 void add(Element element) { |
| 226 elements.add(element); | 225 elements.add(element); |
| 227 } | 226 } |
| 228 | 227 |
| 229 bool get isEmpty => elements.isEmpty; | 228 bool get isEmpty => elements.isEmpty; |
| 230 } | 229 } |
| OLD | NEW |