Index: dart/lib/compiler/implementation/world.dart |
diff --git a/dart/lib/compiler/implementation/world.dart b/dart/lib/compiler/implementation/world.dart |
index 88480cdf6765be1e63d32c0587643327d6fd3bc7..57319da3d35459f43dda0aed02290b94de2d0f04 100644 |
--- a/dart/lib/compiler/implementation/world.dart |
+++ b/dart/lib/compiler/implementation/world.dart |
@@ -52,7 +52,7 @@ class World { |
bool isOnlyFields(Type type, SourceString member) { |
MemberSet memberSet = _memberSetFor(type, member); |
- return !memberSet.isEmpty() && memberSet.hasJustFields(); |
+ return memberSet.hasExactlyOneField(); |
} |
} |
@@ -71,7 +71,16 @@ class MemberSet { |
bool isEmpty() => elements.isEmpty(); |
- bool hasJustFields() { |
- return elements.every((Element element) => element.isField()); |
+ bool hasExactlyOneField() { |
+ int fieldCount = 0; |
+ int nonFieldCount = 0; |
+ elements.forEach((Element element) { |
+ if (element.isField()) { |
+ fieldCount++; |
+ } else { |
+ nonFieldCount++; |
+ } |
+ }); |
+ return fieldCount == 1 && nonFieldCount == 0; |
} |
} |