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

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

Issue 10947024: Made dart2js constructor lookup logic "private"-aware, fixed 4740 bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Another attempt at implementing private-aware constructor lookup logic - with normalized constructo… Created 8 years, 3 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: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 6ecc0848ff4121fed3d06d52c5e05d18925784c2..a557fc3204e064dbc269b8161c3ca1e450ec0ebd 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1376,21 +1376,14 @@ class ClassElement extends ScopeContainerElement
}
}
- Element lookupConstructor(SourceString className,
- [SourceString constructorName =
- const SourceString(''),
- Element noMatch(Element)]) {
+ Element lookupConstructor(Selector selector, [Element noMatch(Element)]) {
// TODO(karlklose): have a map from class names to a map of constructors
// instead of creating the name here?
- SourceString normalizedName;
- if (constructorName !== const SourceString('')) {
- normalizedName = Elements.constructConstructorName(className,
- constructorName);
- } else {
- normalizedName = className;
- }
- Element result = localLookup(normalizedName);
- if (result === null || !result.isConstructor()) {
+ Element result = localLookup(selector.normalizedConstructorName);
+ if (result === null
+ || !result.isConstructor()
+ || (selector.name.isPrivate()
+ && result.getLibrary() != selector.library)) {
result = noMatch !== null ? noMatch(result) : null;
}
return result;

Powered by Google App Engine
This is Rietveld 408576698