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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 967703002: Avoid unnecessary parsing/resolution when running command line analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 @override 130 @override
131 void internalPerform() { 131 void internalPerform() {
132 Source source = getRequiredSource(); 132 Source source = getRequiredSource();
133 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME); 133 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
134 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME); 134 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME);
135 135
136 RecordingErrorListener errorListener = new RecordingErrorListener(); 136 RecordingErrorListener errorListener = new RecordingErrorListener();
137 Parser parser = new Parser(source, errorListener); 137 Parser parser = new Parser(source, errorListener);
138 AnalysisOptions options = context.analysisOptions; 138 AnalysisOptions options = context.analysisOptions;
139 parser.parseFunctionBodies = options.analyzeFunctionBodies; 139 parser.parseFunctionBodies = options.analyzeFunctionBodiesPredicate(source);
140 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); 140 CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
141 unit.lineInfo = lineInfo; 141 unit.lineInfo = lineInfo;
142 142
143 bool hasNonPartOfDirective = false; 143 bool hasNonPartOfDirective = false;
144 bool hasPartOfDirective = false; 144 bool hasPartOfDirective = false;
145 HashSet<Source> exportedSources = new HashSet<Source>(); 145 HashSet<Source> exportedSources = new HashSet<Source>();
146 HashSet<Source> importedSources = new HashSet<Source>(); 146 HashSet<Source> importedSources = new HashSet<Source>();
147 HashSet<Source> includedSources = new HashSet<Source>(); 147 HashSet<Source> includedSources = new HashSet<Source>();
148 for (Directive directive in unit.directives) { 148 for (Directive directive in unit.directives) {
149 if (directive is PartOfDirective) { 149 if (directive is PartOfDirective) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 306
307 /** 307 /**
308 * Create a [ScanDartTask] based on the given [target] in the given [context]. 308 * Create a [ScanDartTask] based on the given [target] in the given [context].
309 */ 309 */
310 static ScanDartTask createTask(AnalysisContext context, 310 static ScanDartTask createTask(AnalysisContext context,
311 AnalysisTarget target) { 311 AnalysisTarget target) {
312 return new ScanDartTask(context, target); 312 return new ScanDartTask(context, target);
313 } 313 }
314 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698