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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/world.dart

Issue 99303004: Remove unused API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 FunctionSet allFunctions; 9 final FunctionSet allFunctions;
10 final Set<Element> functionsCalledInLoop = new Set<Element>(); 10 final Set<Element> functionsCalledInLoop = new Set<Element>();
(...skipping 21 matching lines...) Expand all
32 final Set<Element> elementsThatCannotThrow = new Set<Element>(); 32 final Set<Element> elementsThatCannotThrow = new Set<Element>();
33 33
34 Set<ClassElement> subclassesOf(ClassElement cls) { 34 Set<ClassElement> subclassesOf(ClassElement cls) {
35 return _subclasses[cls.declaration]; 35 return _subclasses[cls.declaration];
36 } 36 }
37 37
38 Set<ClassElement> subtypesOf(ClassElement cls) { 38 Set<ClassElement> subtypesOf(ClassElement cls) {
39 return _subtypes[cls.declaration]; 39 return _subtypes[cls.declaration];
40 } 40 }
41 41
42 Set<ClassElement> superclassesOf(ClassElement cls) {
43 return _superclasses[cls.declaration];
Johnni Winther 2013/12/03 11:52:31 Is _superclasses needed in itself?
ahe 2013/12/04 11:45:43 Removed.
44 }
45
46 Set<ClassElement> supertypesOf(ClassElement cls) { 42 Set<ClassElement> supertypesOf(ClassElement cls) {
47 return _supertypes[cls.declaration]; 43 return _supertypes[cls.declaration];
48 } 44 }
49 45
50 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) { 46 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) {
51 return _typesImplementedBySubclasses[cls.declaration]; 47 return _typesImplementedBySubclasses[cls.declaration];
52 } 48 }
53 49
54 bool hasSubclasses(ClassElement cls) { 50 bool hasSubclasses(ClassElement cls) {
55 Set<ClassElement> subclasses = compiler.world.subclassesOf(cls); 51 Set<ClassElement> subclasses = compiler.world.subclassesOf(cls);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 140
145 bool hasAnySubtype(ClassElement cls) { 141 bool hasAnySubtype(ClassElement cls) {
146 Set<ClassElement> classes = subtypesOf(cls); 142 Set<ClassElement> classes = subtypesOf(cls);
147 return classes != null && !classes.isEmpty; 143 return classes != null && !classes.isEmpty;
148 } 144 }
149 145
150 bool hasAnyUserDefinedGetter(Selector selector) { 146 bool hasAnyUserDefinedGetter(Selector selector) {
151 return allFunctions.filter(selector).any((each) => each.isGetter()); 147 return allFunctions.filter(selector).any((each) => each.isGetter());
152 } 148 }
153 149
154 bool hasAnyUserDefinedSetter(Selector selector) {
155 return allFunctions.filter(selector).any((each) => each.isSetter());
156 }
157
158 // Returns whether a subclass of [superclass] implements [type]. 150 // Returns whether a subclass of [superclass] implements [type].
159 bool hasAnySubclassThatImplements(ClassElement superclass, 151 bool hasAnySubclassThatImplements(ClassElement superclass,
160 ClassElement type) { 152 ClassElement type) {
161 Set<ClassElement> subclasses = typesImplementedBySubclassesOf(superclass); 153 Set<ClassElement> subclasses = typesImplementedBySubclassesOf(superclass);
162 if (subclasses == null) return false; 154 if (subclasses == null) return false;
163 return subclasses.contains(type); 155 return subclasses.contains(type);
164 } 156 }
165 157
166 // Returns whether a subclass of any mixin application of [cls] implements 158 // Returns whether a subclass of any mixin application of [cls] implements
167 // [type]. 159 // [type].
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return (result != null && result.isField()) ? result : null; 193 return (result != null && result.isField()) ? result : null;
202 } 194 }
203 195
204 Element locateSingleElement(Selector selector) { 196 Element locateSingleElement(Selector selector) {
205 ti.TypeMask mask = selector.mask == null 197 ti.TypeMask mask = selector.mask == null
206 ? new ti.TypeMask.subclass(compiler.objectClass) 198 ? new ti.TypeMask.subclass(compiler.objectClass)
207 : selector.mask; 199 : selector.mask;
208 return mask.locateSingleElement(selector, compiler); 200 return mask.locateSingleElement(selector, compiler);
209 } 201 }
210 202
211 bool hasSingleMatch(Selector selector) {
212 Iterable<Element> targets = allFunctions.filter(selector);
213 return targets.length == 1;
214 }
215
216 Iterable<ClassElement> locateNoSuchMethodHolders(Selector selector) {
217 Selector noSuchMethodSelector = compiler.noSuchMethodSelector;
218 ti.TypeMask mask = selector.mask;
219 if (mask != null) {
220 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector);
221 }
222 ClassElement objectClass = compiler.objectClass;
223 return allFunctions
224 .filter(noSuchMethodSelector)
225 .map((Element member) => member.getEnclosingClass())
226 .where((ClassElement holder) => !identical(holder, objectClass));
227 }
228
229 void addFunctionCalledInLoop(Element element) { 203 void addFunctionCalledInLoop(Element element) {
230 functionsCalledInLoop.add(element.declaration); 204 functionsCalledInLoop.add(element.declaration);
231 } 205 }
232 206
233 bool isCalledInLoop(Element element) { 207 bool isCalledInLoop(Element element) {
234 return functionsCalledInLoop.contains(element.declaration); 208 return functionsCalledInLoop.contains(element.declaration);
235 } 209 }
236 210
237 bool fieldNeverChanges(Element element) { 211 bool fieldNeverChanges(Element element) {
238 if (!element.isField()) return false; 212 if (!element.isField()) return false;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 273 }
300 274
301 void registerCannotThrow(Element element) { 275 void registerCannotThrow(Element element) {
302 elementsThatCannotThrow.add(element); 276 elementsThatCannotThrow.add(element);
303 } 277 }
304 278
305 bool getCannotThrow(Element element) { 279 bool getCannotThrow(Element element) {
306 return elementsThatCannotThrow.contains(element); 280 return elementsThatCannotThrow.contains(element);
307 } 281 }
308 } 282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698