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 9aaa8c8c98be79290fedfa40184139109bdc7b5f..f27614d91973641bd416bb10ff3df3e28df28144 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -1331,7 +1331,7 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
Source partSource = partDirective.source; |
hasPartDirective = true; |
CompilationUnit partUnit = partUnitMap[partSource]; |
- if (partUnit != null && context.exists(partSource)) { |
+ if (partUnit != null) { |
CompilationUnitElementImpl partElement = partUnit.element; |
partElement.uriOffset = partUri.offset; |
partElement.uriEnd = partUri.end; |
@@ -1340,24 +1340,26 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
// Validate that the part contains a part-of directive with the same |
// name as the library. |
// |
- String partLibraryName = |
- _getPartLibraryName(partSource, partUnit, directivesToResolve); |
- if (partLibraryName == null) { |
- errors.add(new AnalysisError(librarySource, partUri.offset, |
- partUri.length, CompileTimeErrorCode.PART_OF_NON_PART, |
- [partUri.toSource()])); |
- } else if (libraryNameNode == null) { |
- if (partsLibraryName == _UNKNOWN_LIBRARY_NAME) { |
- partsLibraryName = partLibraryName; |
- } else if (partsLibraryName != partLibraryName) { |
- partsLibraryName = null; |
+ if (context.exists(partSource)) { |
+ String partLibraryName = |
+ _getPartLibraryName(partSource, partUnit, directivesToResolve); |
+ if (partLibraryName == null) { |
+ errors.add(new AnalysisError(librarySource, partUri.offset, |
+ partUri.length, CompileTimeErrorCode.PART_OF_NON_PART, |
+ [partUri.toSource()])); |
+ } else if (libraryNameNode == null) { |
+ if (partsLibraryName == _UNKNOWN_LIBRARY_NAME) { |
+ partsLibraryName = partLibraryName; |
+ } else if (partsLibraryName != partLibraryName) { |
+ partsLibraryName = null; |
+ } |
+ } else if (libraryNameNode.name != partLibraryName) { |
+ errors.add(new AnalysisError(librarySource, partUri.offset, |
+ partUri.length, StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, [ |
+ libraryNameNode.name, |
+ partLibraryName |
+ ])); |
} |
- } else if (libraryNameNode.name != partLibraryName) { |
- errors.add(new AnalysisError(librarySource, partUri.offset, |
- partUri.length, StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, [ |
- libraryNameNode.name, |
- partLibraryName |
- ])); |
} |
if (entryPoint == null) { |
entryPoint = _findEntryPoint(partElement); |