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

Unified Diff: pkg/analyzer/lib/src/dart/resolver/scope.dart

Issue 2290373003: Move error checking from scope creation to error reporter (take 2) (Closed)
Patch Set: Created 4 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 | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698