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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 712663002: Fix for issue 20125 - improved error messages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 374e6a3c6f7375b6ad3fe474b075ac5e567c3d54..bf9b88fec379f465d020d3ea39dad48347e32b0e 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -2783,10 +2783,20 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
LibraryElement prevLibrary = _nameToExportElement[name];
if (prevLibrary != null) {
if (prevLibrary != exportedLibrary) {
- _errorReporter.reportErrorForNode(StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME, node, [
- prevLibrary.definingCompilationUnit.displayName,
- exportedLibrary.definingCompilationUnit.displayName,
- name]);
+ if (name.isEmpty) {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_UNNAMED,
+ node,
+ [prevLibrary.definingCompilationUnit.displayName,
+ exportedLibrary.definingCompilationUnit.displayName]);
+ } else {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED,
+ node,
+ [prevLibrary.definingCompilationUnit.displayName,
+ exportedLibrary.definingCompilationUnit.displayName,
+ name]);
+ }
return true;
}
} else {
@@ -3228,14 +3238,24 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return false;
}
String name = nodeLibrary.name;
- // check if there is other imported library with the same name
+ // check if there is another imported library with the same name
LibraryElement prevLibrary = _nameToImportElement[name];
if (prevLibrary != null) {
if (prevLibrary != nodeLibrary) {
- _errorReporter.reportErrorForNode(StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME, node, [
- prevLibrary.definingCompilationUnit.displayName,
- nodeLibrary.definingCompilationUnit.displayName,
- name]);
+ if (name.isEmpty) {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_UNNAMED,
+ node,
+ [prevLibrary.definingCompilationUnit.displayName,
+ nodeLibrary.definingCompilationUnit.displayName]);
+ } else {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED,
+ node,
+ [prevLibrary.definingCompilationUnit.displayName,
+ nodeLibrary.definingCompilationUnit.displayName,
+ name]);
+ }
return true;
}
} else {
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/static_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698