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

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

Issue 14049010: Take noSuchMethod into account when computing the potential targets of a call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months 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 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ? compiler.objectClass 158 ? compiler.objectClass
159 : mask.base.element; 159 : mask.base.element;
160 // We only return the found element if it is guaranteed to be 160 // We only return the found element if it is guaranteed to be
161 // implemented on the exact receiver type. It could be found in a 161 // implemented on the exact receiver type. It could be found in a
162 // subclass or in an inheritance-wise unrelated class in case of 162 // subclass or in an inheritance-wise unrelated class in case of
163 // subtype selectors. 163 // subtype selectors.
164 return (receiverTypeElement.isSubclassOf(enclosing)) ? result : null; 164 return (receiverTypeElement.isSubclassOf(enclosing)) ? result : null;
165 } 165 }
166 166
167 Iterable<ClassElement> locateNoSuchMethodHolders(Selector selector) { 167 Iterable<ClassElement> locateNoSuchMethodHolders(Selector selector) {
168 Selector noSuchMethodSelector = new Selector.noSuchMethod(); 168 Selector noSuchMethodSelector = compiler.noSuchMethodSelector;
169 ti.TypeMask mask = selector.mask; 169 ti.TypeMask mask = selector.mask;
170 if (mask != null) { 170 if (mask != null) {
171 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector); 171 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector);
172 } 172 }
173 ClassElement objectClass = compiler.objectClass; 173 ClassElement objectClass = compiler.objectClass;
174 return allFunctions 174 return allFunctions
175 .filter(noSuchMethodSelector) 175 .filter(noSuchMethodSelector)
176 .map((Element member) => member.getEnclosingClass()) 176 .map((Element member) => member.getEnclosingClass())
177 .where((ClassElement holder) => !identical(holder, objectClass)); 177 .where((ClassElement holder) => !identical(holder, objectClass));
178 } 178 }
179 179
180 void addFunctionCalledInLoop(Element element) { 180 void addFunctionCalledInLoop(Element element) {
181 functionsCalledInLoop.add(element); 181 functionsCalledInLoop.add(element);
182 } 182 }
183 183
184 bool isCalledInLoop(Element element) { 184 bool isCalledInLoop(Element element) {
185 return functionsCalledInLoop.contains(element); 185 return functionsCalledInLoop.contains(element);
186 } 186 }
187 } 187 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/universe/universe.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698