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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 62373009: Field property naming fix - issues 14096, 14806 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review changes Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 9612da5970829345c2e6a6633f98fdc8c81b8f42..042e5c828608d2a7e55545fa0d626479c53560a0 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -1904,25 +1904,25 @@ abstract class BaseClassElementX extends ElementX implements ClassElement {
}
/**
- * Returns true if the [fieldMember] is shadowed by another field. The given
- * [fieldMember] must be a member of this class.
+ * Returns true if the [fieldMember] shadows another field. The given
+ * [fieldMember] must be a member of this class, i.e. if there is a field of
+ * the same name in the superclass chain.
*
* This method also works if the [fieldMember] is private.
*/
- bool isShadowedByField(Element fieldMember) {
+ bool hasFieldShadowedBy(Element fieldMember) {
assert(fieldMember.isField());
String fieldName = fieldMember.name;
bool isPrivate = isPrivateName(fieldName);
LibraryElement memberLibrary = fieldMember.getLibrary();
- ClassElement lookupClass = this;
+ ClassElement lookupClass = this.superclass;
while (lookupClass != null) {
Element foundMember = lookupClass.lookupLocalMember(fieldName);
if (foundMember != null) {
- if (foundMember == fieldMember) return false;
if (foundMember.isField()) {
if (!isPrivate || memberLibrary == foundMember.getLibrary()) {
- // Private fields can only be shadowed by a field declared
- // in the same library.
+ // Private fields can only be shadowed by a field declared in the
+ // same library.
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698