| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Mixins that implement convenience methods on [Element] subclasses. | 5 /// Mixins that implement convenience methods on [Element] subclasses. |
| 6 | 6 |
| 7 library elements.common; | 7 library elements.common; |
| 8 | 8 |
| 9 import '../common/names.dart' show Identifiers, Names, Uris; | 9 import '../common/names.dart' show Identifiers, Names, Uris; |
| 10 import '../common_elements.dart' show CommonElements; | 10 import '../common_elements.dart' show CommonElements; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 407 } |
| 408 | 408 |
| 409 /** | 409 /** |
| 410 * Returns true if the [fieldMember] shadows another field. The given | 410 * Returns true if the [fieldMember] shadows another field. The given |
| 411 * [fieldMember] must be a member of this class, i.e. if there is a field of | 411 * [fieldMember] must be a member of this class, i.e. if there is a field of |
| 412 * the same name in the superclass chain. | 412 * the same name in the superclass chain. |
| 413 * | 413 * |
| 414 * This method also works if the [fieldMember] is private. | 414 * This method also works if the [fieldMember] is private. |
| 415 */ | 415 */ |
| 416 @override | 416 @override |
| 417 bool hasFieldShadowedBy(Element fieldMember) { | 417 bool hasFieldShadowedBy(FieldElement fieldMember) { |
| 418 assert(fieldMember.isField); | 418 assert(fieldMember.isField); |
| 419 String fieldName = fieldMember.name; | 419 String fieldName = fieldMember.name; |
| 420 bool isPrivate = Name.isPrivateName(fieldName); | 420 bool isPrivate = Name.isPrivateName(fieldName); |
| 421 LibraryElement memberLibrary = fieldMember.library; | 421 LibraryElement memberLibrary = fieldMember.library; |
| 422 ClassElement lookupClass = this.superclass; | 422 ClassElement lookupClass = this.superclass; |
| 423 while (lookupClass != null) { | 423 while (lookupClass != null) { |
| 424 Element foundMember = lookupClass.lookupLocalMember(fieldName); | 424 Element foundMember = lookupClass.lookupLocalMember(fieldName); |
| 425 if (foundMember != null) { | 425 if (foundMember != null) { |
| 426 if (foundMember.isField) { | 426 if (foundMember.isField) { |
| 427 if (!isPrivate || memberLibrary == foundMember.library) { | 427 if (!isPrivate || memberLibrary == foundMember.library) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 @override | 669 @override |
| 670 bool get isBoolFromEnvironmentConstructor { | 670 bool get isBoolFromEnvironmentConstructor { |
| 671 return fromEnvironmentState == _FromEnvironmentState.BOOL; | 671 return fromEnvironmentState == _FromEnvironmentState.BOOL; |
| 672 } | 672 } |
| 673 | 673 |
| 674 @override | 674 @override |
| 675 bool get isStringFromEnvironmentConstructor { | 675 bool get isStringFromEnvironmentConstructor { |
| 676 return fromEnvironmentState == _FromEnvironmentState.STRING; | 676 return fromEnvironmentState == _FromEnvironmentState.STRING; |
| 677 } | 677 } |
| 678 } | 678 } |
| OLD | NEW |