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 13af33f185b0d2b2dcb9675a1f7d853a78ad144b..9dc108257b24214576011c40a6aec86e73c1ad97 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -1302,42 +1302,40 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
PartDirective partDirective = directive; |
StringLiteral partUri = partDirective.uri; |
Source partSource = partDirective.source; |
- if (context.exists(partSource)) { |
- hasPartDirective = true; |
- CompilationUnit partUnit = partUnitMap[partSource]; |
- CompilationUnitElementImpl partElement = partUnit.element; |
- partElement.uriOffset = partUri.offset; |
- partElement.uriEnd = partUri.end; |
- partElement.uri = partDirective.uriContent; |
- // |
- // 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; |
- } |
- } else if (libraryNameNode.name != partLibraryName) { |
- errors.add(new AnalysisError(librarySource, partUri.offset, |
- partUri.length, StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, [ |
- libraryNameNode.name, |
- partLibraryName |
- ])); |
+ hasPartDirective = true; |
+ CompilationUnit partUnit = partUnitMap[partSource]; |
+ CompilationUnitElementImpl partElement = partUnit.element; |
+ partElement.uriOffset = partUri.offset; |
+ partElement.uriEnd = partUri.end; |
+ partElement.uri = partDirective.uriContent; |
+ // |
+ // 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 (entryPoint == null) { |
- entryPoint = _findEntryPoint(partElement); |
- } |
- directive.element = partElement; |
- sourcedCompilationUnits.add(partElement); |
+ } 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); |
} |
+ directive.element = partElement; |
+ sourcedCompilationUnits.add(partElement); |
} |
} |
if (hasPartDirective && libraryNameNode == null) { |