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

Side by Side Diff: pkg/compiler/lib/src/elements/common.dart

Issue 2428543002: Optimize needNoSuchMethodHandling computation (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Mixins that implement convenience methods on [Element] subclasses. 5 /// Mixins that implement convenience methods on [Element] subclasses.
6 6
7 library elements.common; 7 library elements.common;
8 8
9 import '../common/names.dart' show Identifiers, Names, Uris; 9 import '../common/names.dart' show Identifiers, Names, Uris;
10 import '../core_types.dart' show CoreClasses; 10 import '../core_types.dart' show CoreClasses;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 /** 208 /**
209 * Find the first member in the class chain with the given [memberName]. 209 * Find the first member in the class chain with the given [memberName].
210 * 210 *
211 * This method is NOT to be used for resolving 211 * This method is NOT to be used for resolving
212 * unqualified sends because it does not implement the scoping 212 * unqualified sends because it does not implement the scoping
213 * rules, where library scope comes before superclass scope. 213 * rules, where library scope comes before superclass scope.
214 * 214 *
215 * When called on the implementation element both members declared in the 215 * When called on the implementation element both members declared in the
216 * origin and the patch class are returned. 216 * origin and the patch class are returned.
217 */ 217 */
218 Element lookupByName(Name memberName) { 218 Element lookupByName(Name memberName, {ClassElement stopAtSuperclass}) {
219 return internalLookupByName(memberName, isSuperLookup: false); 219 return internalLookupByName(memberName,
220 isSuperLookup: false, stopAtSuperclass: stopAtSuperclass);
220 } 221 }
221 222
222 Element lookupSuperByName(Name memberName) { 223 Element lookupSuperByName(Name memberName) {
223 return internalLookupByName(memberName, isSuperLookup: true); 224 return internalLookupByName(memberName, isSuperLookup: true);
224 } 225 }
225 226
226 Element internalLookupByName(Name memberName, {bool isSuperLookup}) { 227 Element internalLookupByName(Name memberName,
228 {bool isSuperLookup, ClassElement stopAtSuperclass}) {
227 String name = memberName.text; 229 String name = memberName.text;
228 bool isPrivate = memberName.isPrivate; 230 bool isPrivate = memberName.isPrivate;
229 LibraryElement library = memberName.library; 231 LibraryElement library = memberName.library;
230 for (ClassElement current = isSuperLookup ? superclass : this; 232 for (ClassElement current = isSuperLookup ? superclass : this;
231 current != null; 233 current != null && current != stopAtSuperclass;
232 current = current.superclass) { 234 current = current.superclass) {
233 Element member = current.lookupLocalMember(name); 235 Element member = current.lookupLocalMember(name);
234 if (member == null && current.isPatched) { 236 if (member == null && current.isPatched) {
235 // Doing lookups on selectors is done after resolution, so it 237 // Doing lookups on selectors is done after resolution, so it
236 // is safe to look in the patch class. 238 // is safe to look in the patch class.
237 member = current.patch.lookupLocalMember(name); 239 member = current.patch.lookupLocalMember(name);
238 } 240 }
239 if (member == null) continue; 241 if (member == null) continue;
240 // Private members from a different library are not visible. 242 // Private members from a different library are not visible.
241 if (isPrivate && !identical(library, member.library)) continue; 243 if (isPrivate && !identical(library, member.library)) continue;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 @override 639 @override
638 bool get isBoolFromEnvironmentConstructor { 640 bool get isBoolFromEnvironmentConstructor {
639 return fromEnvironmentState == _FromEnvironmentState.BOOL; 641 return fromEnvironmentState == _FromEnvironmentState.BOOL;
640 } 642 }
641 643
642 @override 644 @override
643 bool get isStringFromEnvironmentConstructor { 645 bool get isStringFromEnvironmentConstructor {
644 return fromEnvironmentState == _FromEnvironmentState.STRING; 646 return fromEnvironmentState == _FromEnvironmentState.STRING;
645 } 647 }
646 } 648 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/elements.dart » ('j') | pkg/compiler/lib/src/elements/elements.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698