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

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

Issue 10832291: Add missing abort on duplicate class fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index ea7c5dde6e0b27d0dad267e3288cfe1791fa80f5..6c10b8dd540f04c8b17e5ff46da57a7b560a098b 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1030,7 +1030,11 @@ class ClassElement extends ContainerElement
|| element.kind == ElementKind.SETTER) {
addGetterOrSetter(element, localMembers[element.name], listener);
} else {
- localMembers[element.name] = element;
+ Element existing = localMembers.putIfAbsent(element.name, () => element);
+ if (existing !== element) {
+ listener.cancel('duplicate definition', token: element.position());
+ listener.cancel('existing definition', token: existing.position());
Lasse Reichstein Nielsen 2012/08/14 10:28:24 What's the right way to do this?
+ }
}
}
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698