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

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

Issue 10827359: Fix field-accesses for private fields that were "shadowed" by other private fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments. Created 8 years, 4 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 | « no previous file | lib/compiler/implementation/ssa/optimize.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 53cf714a52f61cda386d2358ab8bb86f53f85283..778084f1ac497624543c7427eeb4448360e779c7 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1059,13 +1059,22 @@ class ClassElement extends ScopeContainerElement
}
/**
- * Lookup super members for the class. This will ignore constructors.
+ * Lookup super members for the class. This will ignore constructors.
*/
Element lookupSuperMember(SourceString memberName) {
+ return lookupSuperMemberInLibrary(memberName, getLibrary());
+ }
+
+ /**
+ * Lookup super members for the class that is accessible in [library].
+ * This will ignore constructors.
+ */
+ Element lookupSuperMemberInLibrary(SourceString memberName,
+ LibraryElement library) {
bool isPrivate = memberName.isPrivate();
for (ClassElement s = superclass; s != null; s = s.superclass) {
// Private members from a different library are not visible.
- if (isPrivate && getLibrary() !== s.getLibrary()) continue;
+ if (isPrivate && library !== s.getLibrary()) continue;
Element e = s.lookupLocalMember(memberName);
if (e === null) continue;
// Static members are not inherited.
@@ -1094,6 +1103,24 @@ class ClassElement extends ScopeContainerElement
}
/**
+ * Find the first member in the class chain with the given [selector].
+ *
+ * This method is NOT to be used for resolving
+ * unqualified sends because it does not implement the scoping
+ * rules, where library scope comes before superclass scope.
+ */
+ Element lookupSelector(Selector selector) {
+ SourceString memberName = selector.name;
+ LibraryElement library = selector.library;
+ Element localMember = lookupLocalMember(memberName);
+ if (localMember != null &&
+ (!memberName.isPrivate() || getLibrary() == library)) {
+ return localMember;
+ }
+ return lookupSuperMemberInLibrary(memberName, library);
+ }
+
+ /**
* Find the first member in the class chain with the given
* [memberName]. This method is NOT to be used for resolving
* unqualified sends because it does not implement the scoping
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698