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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 11085092: Revert "Made dart2js constructor lookup logic "private"-aware, fixed 4740 bug." and 5 subsequent at… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index dc70d0f39b13d28cea2c6ccf8e5451055e4058fe..5ae09393b8676ffe7965d4512737af376ae96625 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1475,42 +1475,24 @@ abstract class ClassElement extends ScopeContainerElement
}
}
- Element validateConstructorLookupResults(Selector selector,
- Element result,
- Element noMatch(Element)) {
- if (result === null
- || !result.isConstructor()
- || (selector.name.isPrivate()
- && result.getLibrary() != selector.library)) {
- result = noMatch !== null ? noMatch(result) : null;
- }
- return result;
- }
-
- // 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 lookupConstructor(SourceString className,
+ [SourceString constructorName =
+ const SourceString(''),
+ Element noMatch(Element)]) {
+ // TODO(karlklose): have a map from class names to a map of constructors
+ // instead of creating the name here?
SourceString normalizedName;
- SourceString className = this.name;
- SourceString constructorName = selector.name;
- if (constructorName !== const SourceString('') &&
- ((className === null) ||
- (constructorName.slowToString() != className.slowToString()))) {
+ if (constructorName !== const SourceString('')) {
normalizedName = Elements.constructConstructorName(className,
constructorName);
} else {
normalizedName = className;
}
Element result = localLookup(normalizedName);
- return validateConstructorLookupResults(selector, result, noMatch);
- }
-
- Element lookupFactoryConstructor(Selector selector,
- [Element noMatch(Element)]) {
- SourceString constructorName = selector.name;
- Element result = localLookup(constructorName);
- return validateConstructorLookupResults(selector, result, noMatch);
+ if (result === null || !result.isConstructor()) {
+ result = noMatch !== null ? noMatch(result) : null;
+ }
+ return result;
}
bool get hasConstructor {
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698