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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 5045 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 */ 5056 */
5057 static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME'; 5057 static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME';
5058 5058
5059 /** 5059 /**
5060 * The task descriptor describing this kind of task. 5060 * The task descriptor describing this kind of task.
5061 */ 5061 */
5062 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 5062 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
5063 'ScanDartTask', 5063 'ScanDartTask',
5064 createTask, 5064 createTask,
5065 buildInputs, 5065 buildInputs,
5066 <ResultDescriptor>[LINE_INFO, SCAN_ERRORS, TOKEN_STREAM]); 5066 <ResultDescriptor>[LINE_INFO, SCAN_ERRORS, TOKEN_STREAM],
5067 suitabilityFor: suitabilityFor);
5067 5068
5068 /** 5069 /**
5069 * Initialize a newly created task to access the content of the source 5070 * Initialize a newly created task to access the content of the source
5070 * associated with the given [target] in the given [context]. 5071 * associated with the given [target] in the given [context].
5071 */ 5072 */
5072 ScanDartTask(InternalAnalysisContext context, AnalysisTarget target) 5073 ScanDartTask(InternalAnalysisContext context, AnalysisTarget target)
5073 : super(context, target); 5074 : super(context, target);
5074 5075
5075 @override 5076 @override
5076 TaskDescriptor get descriptor => DESCRIPTOR; 5077 TaskDescriptor get descriptor => DESCRIPTOR;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 'Cannot build inputs for a ${target.runtimeType}'); 5153 'Cannot build inputs for a ${target.runtimeType}');
5153 } 5154 }
5154 5155
5155 /** 5156 /**
5156 * Create a [ScanDartTask] based on the given [target] in the given [context]. 5157 * Create a [ScanDartTask] based on the given [target] in the given [context].
5157 */ 5158 */
5158 static ScanDartTask createTask( 5159 static ScanDartTask createTask(
5159 AnalysisContext context, AnalysisTarget target) { 5160 AnalysisContext context, AnalysisTarget target) {
5160 return new ScanDartTask(context, target); 5161 return new ScanDartTask(context, target);
5161 } 5162 }
5163
5164 /**
5165 * Return an indication of how suitable this task is for the given [target].
5166 */
5167 static TaskSuitability suitabilityFor(AnalysisTarget target) {
5168 if (target is Source) {
5169 if (target.shortName.endsWith(AnalysisEngine.SUFFIX_DART)) {
5170 return TaskSuitability.HIGHEST;
5171 }
5172 return TaskSuitability.LOWEST;
5173 } else if (target is DartScript) {
5174 return TaskSuitability.HIGHEST;
5175 }
5176 return TaskSuitability.NONE;
5177 }
5162 } 5178 }
5163 5179
5164 /** 5180 /**
5165 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds 5181 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds
5166 * [RESOLVED_UNIT] for a unit. 5182 * [RESOLVED_UNIT] for a unit.
5167 */ 5183 */
5168 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { 5184 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask {
5169 /** 5185 /**
5170 * The name of the [RESOLVED_UNIT11] input. 5186 * The name of the [RESOLVED_UNIT11] input.
5171 */ 5187 */
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
5462 5478
5463 @override 5479 @override
5464 bool moveNext() { 5480 bool moveNext() {
5465 if (_newSources.isEmpty) { 5481 if (_newSources.isEmpty) {
5466 return false; 5482 return false;
5467 } 5483 }
5468 currentTarget = _newSources.removeLast(); 5484 currentTarget = _newSources.removeLast();
5469 return true; 5485 return true;
5470 } 5486 }
5471 } 5487 }
OLDNEW
« 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