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

Unified Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 868643002: Revert "Change signature of lookupConstructor to only require a name." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index ad0f0a9ba0f1b7e43b9818c991947f2be15d62c4..0531a73146c188b08eaa188d423d28b1fa93db1f 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -2400,18 +2400,24 @@ abstract class BaseClassElementX extends ElementX
return false;
}
- ConstructorElement lookupDefaultConstructor() {
- ConstructorElement constructor = lookupConstructor("");
- if (constructor != null
- && constructor.functionSignature.requiredParameterCount == 0) {
- return constructor;
+ Element validateConstructorLookupResults(Selector selector,
+ Element result,
+ Element noMatch(Element)) {
+ if (result == null
+ || !result.isConstructor
+ || (isPrivateName(selector.name)
+ && result.library != selector.library)) {
+ result = noMatch != null ? noMatch(result) : null;
}
- return null;
+ return result;
}
- ConstructorElement lookupConstructor(String name) {
- Element result = localLookup(name);
- return result != null && result.isConstructor ? result : null;
+ // TODO(aprelev@gmail.com): Peter believes that it would be great to
+ // make noMatch a required argument. Peter's suspicion is that most
+ // callers of this method would benefit from using the noMatch method.
+ Element lookupConstructor(Selector selector, [Element noMatch(Element)]) {
+ Element result = localLookup(selector.name);
+ return validateConstructorLookupResults(selector, result, noMatch);
}
Link<Element> get constructors {
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/inferrer/concrete_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698