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

Unified Diff: pkg/analyzer/lib/src/task/yaml.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 | « pkg/analyzer/lib/src/task/options.dart ('k') | pkg/analyzer/lib/task/model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/yaml.dart
diff --git a/pkg/analyzer/lib/src/task/yaml.dart b/pkg/analyzer/lib/src/task/yaml.dart
index 2fdf1324318212309c2fdec45826eb240d6a6eba..8ce7ec1bc53a88771e3e09de2223ac06e6ca2821 100644
--- a/pkg/analyzer/lib/src/task/yaml.dart
+++ b/pkg/analyzer/lib/src/task/yaml.dart
@@ -33,7 +33,8 @@ class ParseYamlTask extends SourceBasedAnalysisTask {
'ParseYamlTask',
createTask,
buildInputs,
- <ResultDescriptor>[YAML_DOCUMENT, YAML_ERRORS, YAML_LINE_INFO]);
+ <ResultDescriptor>[YAML_DOCUMENT, YAML_ERRORS, LINE_INFO],
+ suitabilityFor: suitabilityFor);
/**
* Initialize a newly created task to access the content of the source
@@ -69,7 +70,7 @@ class ParseYamlTask extends SourceBasedAnalysisTask {
new AnalysisError(
source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message])
];
- outputs[YAML_LINE_INFO] = new LineInfo(<int>[0]);
+ outputs[LINE_INFO] = new LineInfo(<int>[0]);
} else {
YamlDocument document;
List<AnalysisError> errors = <AnalysisError>[];
@@ -90,7 +91,7 @@ class ParseYamlTask extends SourceBasedAnalysisTask {
//
outputs[YAML_DOCUMENT] = document;
outputs[YAML_ERRORS] = errors;
- outputs[YAML_LINE_INFO] = new LineInfo.fromContent(content);
+ outputs[LINE_INFO] = new LineInfo.fromContent(content);
}
}
@@ -110,6 +111,16 @@ class ParseYamlTask extends SourceBasedAnalysisTask {
AnalysisContext context, AnalysisTarget target) {
return new ParseYamlTask(context, target);
}
+
+ /**
+ * Return an indication of how suitable this task is for the given [target].
+ */
+ static TaskSuitability suitabilityFor(AnalysisTarget target) {
+ if (target is Source && target.shortName.endsWith('.yaml')) {
+ return TaskSuitability.HIGHEST;
+ }
+ return TaskSuitability.NONE;
+ }
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/task/options.dart ('k') | pkg/analyzer/lib/task/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698