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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../../compiler.dart' as api; 8 import '../../compiler.dart' as api;
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 * [memberName]. This method is NOT to be used for resolving 1897 * [memberName]. This method is NOT to be used for resolving
1898 * unqualified sends because it does not implement the scoping 1898 * unqualified sends because it does not implement the scoping
1899 * rules, where library scope comes before superclass scope. 1899 * rules, where library scope comes before superclass scope.
1900 */ 1900 */
1901 Element lookupMember(String memberName) { 1901 Element lookupMember(String memberName) {
1902 Element localMember = lookupLocalMember(memberName); 1902 Element localMember = lookupLocalMember(memberName);
1903 return localMember == null ? lookupSuperMember(memberName) : localMember; 1903 return localMember == null ? lookupSuperMember(memberName) : localMember;
1904 } 1904 }
1905 1905
1906 /** 1906 /**
1907 * Returns true if the [fieldMember] is shadowed by another field. The given 1907 * Returns true if the [fieldMember] shadows another field. The given
1908 * [fieldMember] must be a member of this class. 1908 * [fieldMember] must be a member of this class, i.e. if there is a field of
1909 * the same name in the superclass chain.
1909 * 1910 *
1910 * This method also works if the [fieldMember] is private. 1911 * This method also works if the [fieldMember] is private.
1911 */ 1912 */
1912 bool isShadowedByField(Element fieldMember) { 1913 bool hasFieldShadowedBy(Element fieldMember) {
1913 assert(fieldMember.isField()); 1914 assert(fieldMember.isField());
1914 String fieldName = fieldMember.name; 1915 String fieldName = fieldMember.name;
1915 bool isPrivate = isPrivateName(fieldName); 1916 bool isPrivate = isPrivateName(fieldName);
1916 LibraryElement memberLibrary = fieldMember.getLibrary(); 1917 LibraryElement memberLibrary = fieldMember.getLibrary();
1917 ClassElement lookupClass = this; 1918 ClassElement lookupClass = this.superclass;
1918 while (lookupClass != null) { 1919 while (lookupClass != null) {
1919 Element foundMember = lookupClass.lookupLocalMember(fieldName); 1920 Element foundMember = lookupClass.lookupLocalMember(fieldName);
1920 if (foundMember != null) { 1921 if (foundMember != null) {
1921 if (foundMember == fieldMember) return false;
1922 if (foundMember.isField()) { 1922 if (foundMember.isField()) {
1923 if (!isPrivate || memberLibrary == foundMember.getLibrary()) { 1923 if (!isPrivate || memberLibrary == foundMember.getLibrary()) {
1924 // Private fields can only be shadowed by a field declared 1924 // Private fields can only be shadowed by a field declared in the
1925 // in the same library. 1925 // same library.
1926 return true; 1926 return true;
1927 } 1927 }
1928 } 1928 }
1929 } 1929 }
1930 lookupClass = lookupClass.superclass; 1930 lookupClass = lookupClass.superclass;
1931 } 1931 }
1932 return false; 1932 return false;
1933 } 1933 }
1934 1934
1935 Element validateConstructorLookupResults(Selector selector, 1935 Element validateConstructorLookupResults(Selector selector,
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 2370
2371 MetadataAnnotation ensureResolved(Compiler compiler) { 2371 MetadataAnnotation ensureResolved(Compiler compiler) {
2372 if (resolutionState == STATE_NOT_STARTED) { 2372 if (resolutionState == STATE_NOT_STARTED) {
2373 compiler.resolver.resolveMetadataAnnotation(this); 2373 compiler.resolver.resolveMetadataAnnotation(this);
2374 } 2374 }
2375 return this; 2375 return this;
2376 } 2376 }
2377 2377
2378 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2378 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2379 } 2379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698