| OLD | NEW |
| 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.general; | 5 library analyzer.src.task.general; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
| 8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 import 'package:analyzer/task/general.dart'; | 9 import 'package:analyzer/task/general.dart'; |
| 10 import 'package:analyzer/task/model.dart'; | 10 import 'package:analyzer/task/model.dart'; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * A task that gets the contents of the source associated with an analysis | 13 * A task that gets the contents of the source associated with an analysis |
| 14 * target. | 14 * target. |
| 15 */ | 15 */ |
| 16 class GetContentTask extends SourceBasedAnalysisTask { | 16 class GetContentTask extends SourceBasedAnalysisTask { |
| 17 /** | 17 /** |
| 18 * The task descriptor describing this kind of task. | 18 * The task descriptor describing this kind of task. |
| 19 */ | 19 */ |
| 20 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('GET_CONTENT', | 20 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('GET_CONTENT', |
| 21 createTask, buildInputs, <ResultDescriptor>[CONTENT, MODIFICATION_TIME]); | 21 createTask, buildInputs, <ResultDescriptor>[CONTENT, MODIFICATION_TIME]); |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Initialize a newly created task to access the content of the source | 24 * Initialize a newly created task to access the content of the source |
| 25 * associated with the given [target] in the given [context]. | 25 * associated with the given [target] in the given [context]. |
| 26 */ | 26 */ |
| 27 GetContentTask(InternalAnalysisContext context, AnalysisTarget target) | 27 GetContentTask(AnalysisContext context, AnalysisTarget target) |
| 28 : super(context, target); | 28 : super(context, target); |
| 29 | 29 |
| 30 @override | 30 @override |
| 31 TaskDescriptor get descriptor => DESCRIPTOR; | 31 TaskDescriptor get descriptor => DESCRIPTOR; |
| 32 | 32 |
| 33 @override | 33 @override |
| 34 internalPerform() { | 34 internalPerform() { |
| 35 Source source = getRequiredSource(); | 35 Source source = getRequiredSource(); |
| 36 | 36 |
| 37 TimestampedData<String> data = context.getContents(source); | 37 TimestampedData<String> data = context.getContents(source); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 : super(context, target); | 69 : super(context, target); |
| 70 | 70 |
| 71 @override | 71 @override |
| 72 String get description { | 72 String get description { |
| 73 Source source = target.source; | 73 Source source = target.source; |
| 74 String sourceName = | 74 String sourceName = |
| 75 target.source == null ? '<unknown source>' : source.fullName; | 75 target.source == null ? '<unknown source>' : source.fullName; |
| 76 return '${descriptor.name} for source $sourceName'; | 76 return '${descriptor.name} for source $sourceName'; |
| 77 } | 77 } |
| 78 } | 78 } |
| OLD | NEW |