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

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

Issue 1168743002: Reanalyze after creating a referenced part. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 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);

Powered by Google App Engine
This is Rietveld 408576698