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

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2401463004: Issue 27515. Report DUPLICATE_PAR when the same library contains two part directives with the same … (Closed)
Patch Set: Created 4 years, 2 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
Index: pkg/analyzer/lib/src/task/dart.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 01f9495bfa7515a71f9612ee55d58203f7f0d469..83548d3ea3d588680887741b9757afbe4fb3302f 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -1510,6 +1510,7 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
LibraryIdentifier libraryNameNode = null;
String partsLibraryName = _UNKNOWN_LIBRARY_NAME;
bool hasPartDirective = false;
+ Set<String> seenPartUris = new Set<String>();
FunctionElement entryPoint =
_findEntryPoint(definingCompilationUnitElement);
List<Directive> directivesToResolve = <Directive>[];
@@ -1536,6 +1537,18 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
// Validate that the part contains a part-of directive with the same
Paul Berry 2016/10/06 18:18:23 This comment is incorrect.
// name as the library.
//
+ if (!seenPartUris.add(directive.uriContent)) {
+ errors.add(new AnalysisError(
+ librarySource,
+ partUri.offset,
+ partUri.length,
+ CompileTimeErrorCode.DUPLICATE_PART,
+ [directive.uriContent]));
+ }
+ //
+ // Validate that the part contains a part-of directive with the same
+ // name as the library.
+ //
if (context.exists(partSource)) {
String partLibraryName =
_getPartLibraryName(partSource, partUnit, directivesToResolve);
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698