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

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

Issue 1645643002: Replace isAppropriateFor with suitabilityFor and start using it (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.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 e6ae8edbaecf12d4f65a68adb6e5d3470af9d3ba..2c99cd2dbf85646c7566e87018391d02ab4f8fde 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -5063,7 +5063,8 @@ class ScanDartTask extends SourceBasedAnalysisTask {
'ScanDartTask',
createTask,
buildInputs,
- <ResultDescriptor>[LINE_INFO, SCAN_ERRORS, TOKEN_STREAM]);
+ <ResultDescriptor>[LINE_INFO, SCAN_ERRORS, TOKEN_STREAM],
+ suitabilityFor: suitabilityFor);
/**
* Initialize a newly created task to access the content of the source
@@ -5159,6 +5160,21 @@ class ScanDartTask extends SourceBasedAnalysisTask {
AnalysisContext context, AnalysisTarget target) {
return new ScanDartTask(context, target);
}
+
+ /**
+ * Return an indication of how suitable this task is for the given [target].
+ */
+ static TaskSuitability suitabilityFor(AnalysisTarget target) {
+ if (target is Source) {
+ if (target.shortName.endsWith(AnalysisEngine.SUFFIX_DART)) {
+ return TaskSuitability.HIGHEST;
+ }
+ return TaskSuitability.LOWEST;
+ } else if (target is DartScript) {
+ return TaskSuitability.HIGHEST;
+ }
+ return TaskSuitability.NONE;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698