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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2654303003: Ignore files that are hidden by generated files. (Closed)
Patch Set: Created 3 years, 11 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/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 18c81243be454aa0f1e87a4cfed6a274ebf86e1d..69c5f15ef25933243903da88ab5afa99f0e78205 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -74,7 +74,7 @@ class AnalysisDriver {
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 13;
+ static const int DATA_VERSION = 14;
/**
* The name of the driver, e.g. the name of the folder.
@@ -632,6 +632,10 @@ class AnalysisDriver {
*/
AnalysisResult _computeAnalysisResult(String path,
{bool withUnit: false, bool asIsIfPartWithoutLibrary: false}) {
+ if (!_fsState.hasUri(path)) {
+ throw new StateError('The file $path has no URI.');
+ }
+
/**
* If the [file] is a library, return the [file] itself.
* If the [file] is a part, return a library it is known to be a part of.
@@ -940,13 +944,20 @@ class AnalysisDriver {
if (_requestedFiles.isNotEmpty) {
String path = _requestedFiles.keys.first;
try {
- AnalysisResult result = _computeAnalysisResult(path, withUnit: true);
- // If a part without a library, delay its analysis.
- if (result == null) {
- _requestedParts
- .putIfAbsent(path, () => [])
- .addAll(_requestedFiles.remove(path));
- return;
+ AnalysisResult result;
+ if (_fsState.hasUri(path)) {
+ result = _computeAnalysisResult(path, withUnit: true);
+ // If a part without a library, delay its analysis.
+ if (result == null) {
+ _requestedParts
+ .putIfAbsent(path, () => [])
+ .addAll(_requestedFiles.remove(path));
+ return;
+ }
+ // Produce the result.
+ _resultController.add(result);
+ } else {
+ result = null;
}
// Notify the completers.
_requestedFiles.remove(path).forEach((completer) {
@@ -954,7 +965,6 @@ class AnalysisDriver {
});
// Remove from to be analyzed and produce it now.
_filesToAnalyze.remove(path);
- _resultController.add(result);
} catch (exception, stackTrace) {
_filesToAnalyze.remove(path);
_requestedFiles.remove(path).forEach((completer) {
@@ -1008,16 +1018,18 @@ class AnalysisDriver {
if (_priorityFiles.isNotEmpty) {
for (String path in _priorityFiles) {
if (_filesToAnalyze.remove(path)) {
- try {
- AnalysisResult result =
- _computeAnalysisResult(path, withUnit: true);
- if (result == null) {
- _partsToAnalyze.add(path);
- } else {
- _resultController.add(result);
+ if (_fsState.hasUri(path)) {
+ try {
+ AnalysisResult result =
+ _computeAnalysisResult(path, withUnit: true);
+ if (result == null) {
+ _partsToAnalyze.add(path);
+ } else {
+ _resultController.add(result);
+ }
+ } catch (exception, stackTrace) {
+ _reportError(path, exception, stackTrace);
}
- } catch (exception, stackTrace) {
- _reportError(path, exception, stackTrace);
}
return;
}
@@ -1027,15 +1039,17 @@ class AnalysisDriver {
// Analyze a general file.
if (_filesToAnalyze.isNotEmpty) {
String path = _removeFirst(_filesToAnalyze);
- try {
- AnalysisResult result = _computeAnalysisResult(path, withUnit: false);
- if (result == null) {
- _partsToAnalyze.add(path);
- } else {
- _resultController.add(result);
+ if (_fsState.hasUri(path)) {
+ try {
+ AnalysisResult result = _computeAnalysisResult(path, withUnit: false);
+ if (result == null) {
+ _partsToAnalyze.add(path);
+ } else {
+ _resultController.add(result);
+ }
+ } catch (exception, stackTrace) {
+ _reportError(path, exception, stackTrace);
}
- } catch (exception, stackTrace) {
- _reportError(path, exception, stackTrace);
}
return;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/file_state.dart » ('j') | pkg/analyzer/test/src/dart/analysis/base.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698