| Index: lib/compiler/implementation/world.dart
|
| diff --git a/lib/compiler/implementation/world.dart b/lib/compiler/implementation/world.dart
|
| index afef86402415900c9b4bb30aeb5842ffc6543ec1..f8c0519d9f34cf8c1d94c83924412146ebc2fc1e 100644
|
| --- a/lib/compiler/implementation/world.dart
|
| +++ b/lib/compiler/implementation/world.dart
|
| @@ -31,7 +31,7 @@ class World {
|
| /**
|
| * Returns a [MemberSet] that contains the possible targets of a
|
| * selector named [member] accessible from the given [library] on a receiver
|
| - * with the given [type].
|
| + * with the given [type]. This includes all sub types.
|
| *
|
| * The [library] can be `null` if the [member] is not private.
|
| */
|
| @@ -58,26 +58,23 @@ class World {
|
| }
|
|
|
| /**
|
| - * Returns the single field with the given [name] accessible in the given
|
| - * [library]. If there is no such field, or there are multiple possible
|
| - * fields returns `null`.
|
| + * Returns the field in [type] with the given [name] accessible in the given
|
| + * [library]. If no such field exists, or a subclass overrides the field
|
| + * returns `null`.
|
| */
|
| VariableElement locateSingleField(Type type,
|
| LibraryElement library,
|
| SourceString name) {
|
| + ClassElement cls = type.element;
|
| + Element result = cls.lookupMemberInLibrary(name, library);
|
| + if (result == null) return null;
|
| + if (!result.isField()) return null;
|
| +
|
| + // Verify that no subclass overrides the field.
|
| MemberSet memberSet = _memberSetFor(type, library, name);
|
| - int fieldCount = 0;
|
| - int nonFieldCount = 0;
|
| - VariableElement field;
|
| - memberSet.elements.forEach((Element element) {
|
| - if (element.isField()) {
|
| - field = element;
|
| - fieldCount++;
|
| - } else {
|
| - nonFieldCount++;
|
| - }
|
| - });
|
| - return (fieldCount == 1 && nonFieldCount == 0) ? field : null;
|
| + if (memberSet.elements.length != 1) return null;
|
| + assert(memberSet.elements.contains(result));
|
| + return result;
|
| }
|
|
|
| Set<ClassElement> findNoSuchMethodHolders(Type type) {
|
|
|