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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 1753083003: Fix issue where errors aren't reported for a new overlay (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rewritten, with a test Created 4 years, 10 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/update_content_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 887c34b50d029c11836b7a0beff1b405d9fea9e6..1bfe99a3a52ccd409a98a1d5991a7e8888090a35 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -1270,6 +1270,14 @@ class AnalysisServer {
// Protocol parsing should have ensured that we never get here.
throw new AnalysisException('Illegal change type');
}
+
+ AnalysisContext containingContext = getContainingContext(file);
+
+ // Check for an implicitly added but missing source.
+ // (For example, the target of an import might not exist yet.)
+ // We need to do this before setContents, which changes the stamp.
+ bool wasMissing = containingContext?.getModificationStamp(source) == -1;
+
overlayState.setContents(source, newContents);
// If the source does not exist, then it was an overlay-only one.
// Remove it from contexts.
@@ -1289,6 +1297,11 @@ class AnalysisServer {
List<Source> sources = context.getSourcesWithFullName(file);
sources.forEach((Source source) {
anyContextUpdated = true;
+ if (context == containingContext && wasMissing) {
+ // Promote missing source to an explicitly added Source.
+ context.applyChanges(new ChangeSet()..addedSource(source));
+ schedulePerformAnalysisOperation(context);
+ }
if (context.handleContentsChanged(
source, oldContents, newContents, true)) {
schedulePerformAnalysisOperation(context);
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/update_content_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698