Chromium Code Reviews| 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?
|
| + } |
| } |
| } |