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

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

Issue 1167773002: Record SourceKind.UNKNOWN for not existing sources. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5c50018a2fa379f511a16dabb08a2baccc99a270..c4f2dfcbb44e1c96473bb913bd92119f14c73e4c 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -2579,6 +2579,12 @@ class ParseDartTask extends SourceBasedAnalysisTask {
static const String LINE_INFO_INPUT_NAME = 'LINE_INFO_INPUT_NAME';
/**
+ * The name of the input whose value is the modification time of the file.
+ */
+ static const String MODIFICATION_TIME_INPUT_NAME =
+ 'MODIFICATION_TIME_INPUT_NAME';
+
+ /**
* The name of the input whose value is the token stream produced for the file.
*/
static const String TOKEN_STREAM_INPUT_NAME = 'TOKEN_STREAM_INPUT_NAME';
@@ -2612,6 +2618,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
void internalPerform() {
Source source = getRequiredSource();
LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
+ int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT_NAME);
Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME);
RecordingErrorListener errorListener = new RecordingErrorListener();
@@ -2662,7 +2669,9 @@ class ParseDartTask extends SourceBasedAnalysisTask {
// Compute kind.
//
SourceKind sourceKind = SourceKind.LIBRARY;
- if (!hasNonPartOfDirective && hasPartOfDirective) {
+ if (modificationTime == -1) {
+ sourceKind = SourceKind.UNKNOWN;
+ } else if (!hasNonPartOfDirective && hasPartOfDirective) {
sourceKind = SourceKind.PART;
}
//
@@ -2693,6 +2702,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(Source source) {
return <String, TaskInput>{
LINE_INFO_INPUT_NAME: LINE_INFO.of(source),
+ MODIFICATION_TIME_INPUT_NAME: MODIFICATION_TIME.of(source),
TOKEN_STREAM_INPUT_NAME: TOKEN_STREAM.of(source)
};
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698