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

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

Issue 1702753003: LINE_INFO, TOKEN_STREAM access cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | no next file » | 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 b492bb27099edb2fab00b89fc1417c2ded4233c1..b9d7b96e8a5f17c36a318f261f8003fe8c4b7cce 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -2224,6 +2224,16 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('DartErrorsTask',
createTask, buildInputs, <ResultDescriptor>[DART_ERRORS]);
+ /**
+ * The name of the [LINE_INFO_INPUT] input.
+ */
+ static const String LINE_INFO_INPUT = 'LINE_INFO_INPUT';
+
+ /**
+ * The name of the [PARSED_UNIT_INPUT] input.
+ */
+ static const String PARSED_UNIT_INPUT = 'PARSED_UNIT_INPUT';
+
// Prefix for comments ignoring error codes.
static const String _normalizedIgnorePrefix = '//#ignore:';
@@ -2274,14 +2284,9 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
// Sort errors.
errors.sort((AnalysisError e1, AnalysisError e2) => e1.offset - e2.offset);
- Source source = target;
- String contents = context.getContents(source).data;
- Scanner scanner = new Scanner(source, new CharSequenceReader(contents),
- AnalysisErrorListener.NULL_LISTENER);
-
- // Scan.
- Token token = scanner.tokenize();
- LineInfo lineInfo = new LineInfo(scanner.lineStarts);
+ CompilationUnit cu = getRequiredInput(PARSED_UNIT_INPUT);
+ Token token = cu.beginToken;
+ LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT);
int errorIndex = 0;
@@ -2344,6 +2349,8 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
Source source = target;
Map<String, TaskInput> inputs = <String, TaskInput>{};
+ inputs[LINE_INFO_INPUT] = LINE_INFO.of(source);
+ inputs[PARSED_UNIT_INPUT] = PARSED_UNIT.of(source);
EnginePlugin enginePlugin = AnalysisEngine.instance.enginePlugin;
// for Source
for (ResultDescriptor result in enginePlugin.dartErrorsForSource) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698