Index: pkg/analyzer/lib/src/dart/resolver/scope.dart |
diff --git a/pkg/analyzer/lib/src/dart/resolver/scope.dart b/pkg/analyzer/lib/src/dart/resolver/scope.dart |
index ba5b275cbb1395f58ec9433ece3449d9870c7cfa..b514b224044e57f52856c8e7350f225862c413de 100644 |
--- a/pkg/analyzer/lib/src/dart/resolver/scope.dart |
+++ b/pkg/analyzer/lib/src/dart/resolver/scope.dart |
@@ -1107,13 +1107,8 @@ abstract class Scope { |
void define(Element element) { |
String name = _getName(element); |
if (name != null && !name.isEmpty) { |
- if (_definedNames != null && _definedNames.containsKey(name)) { |
- errorListener |
- .onError(getErrorForDuplicate(_definedNames[name], element)); |
- } else { |
- _definedNames ??= new HashMap<String, Element>(); |
- _definedNames[name] = element; |
- } |
+ _definedNames ??= new HashMap<String, Element>(); |
+ _definedNames.putIfAbsent(name, () => element); |
} |
} |