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

Unified Diff: dart/lib/compiler/implementation/world.dart

Issue 10511008: Support overriding fields with fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months 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: 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;
}
}

Powered by Google App Engine
This is Rietveld 408576698