Chromium Code Reviews| 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.model; | 5 library analyzer.src.task.model; |
| 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/task/inputs.dart'; | 8 import 'package:analyzer/src/task/inputs.dart'; |
| 9 import 'package:analyzer/task/model.dart'; | 9 import 'package:analyzer/task/model.dart'; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * A concrete implementation of a [ContributionPoint]. | 12 * A concrete implementation of a [CompositeResultDescriptor]. |
| 13 */ | 13 */ |
| 14 class ContributionPointImpl<V> extends ResultDescriptorImpl<V> | 14 class CompositeResultDescriptorImpl<V> extends ResultDescriptorImpl<V> |
| 15 implements ContributionPoint<V> { | 15 implements CompositeResultDescriptor<V> { |
| 16 /** | 16 /** |
| 17 * The results that contribute to this result. | 17 * The results that contribute to this result. |
| 18 */ | 18 */ |
| 19 final List<ResultDescriptor<V>> contributors = <ResultDescriptor<V>>[]; | 19 final List<ResultDescriptor<V>> contributors = <ResultDescriptor<V>>[]; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Initialize a newly created contribution point to have the given [name]. | 22 * Initialize a newly created composite result to have the given [name]. |
| 23 */ | 23 */ |
| 24 ContributionPointImpl(String name) : super(name, null); | 24 CompositeResultDescriptorImpl(String name) : super(name, null); |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Record that the given analysis [result] contibutes to this result. | 27 * Record that the given analysis [result] contibutes to this result. |
| 28 */ | 28 */ |
| 29 void recordContributor(ResultDescriptor<V> result) { | 29 void recordContributor(ResultDescriptor<V> result) { |
| 30 contributors.add(result); | 30 contributors.add(result); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * A concrete implementation of a [ResultDescriptor]. | 35 * A concrete implementation of a [ResultDescriptor]. |
| 36 */ | 36 */ |
| 37 class ResultDescriptorImpl<V> implements ResultDescriptor<V> { | 37 class ResultDescriptorImpl<V> implements ResultDescriptor<V> { |
| 38 /** | 38 /** |
| 39 * The name of the result, used for debugging. | 39 * The name of the result, used for debugging. |
| 40 */ | 40 */ |
| 41 final String name; | 41 final String name; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Return the default value for results described by this descriptor. | 44 * Return the default value for results described by this descriptor. |
| 45 */ | 45 */ |
| 46 final V defaultValue; | 46 final V defaultValue; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Initialize a newly created analysis result to have the given [name] and | 49 * Initialize a newly created analysis result to have the given [name] and |
| 50 * [defaultValue]. If a contribution point is specified, then this result will | 50 * [defaultValue]. If a composite result is specified, then this result will |
| 51 * contribute to it. | 51 * contribute to it. |
| 52 */ | 52 */ |
| 53 ResultDescriptorImpl(this.name, this.defaultValue, | 53 ResultDescriptorImpl(this.name, this.defaultValue, |
| 54 {ContributionPoint contributesTo}) { | 54 {CompositeResultDescriptor contributesTo}) { |
|
scheglov
2015/03/16 21:48:59
Do we want to use a different name?
Brian Wilkerson
2015/03/17 14:52:20
I thought about it, but I think that the individua
| |
| 55 if (contributesTo is ContributionPointImpl) { | 55 if (contributesTo is CompositeResultDescriptorImpl) { |
| 56 contributesTo.recordContributor(this); | 56 contributesTo.recordContributor(this); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 @override | 60 @override |
| 61 TaskInput<V> inputFor(AnalysisTarget target) => | 61 TaskInput<V> inputFor(AnalysisTarget target) => |
| 62 new SimpleTaskInput<V>(target, this); | 62 new SimpleTaskInput<V>(target, this); |
| 63 | 63 |
| 64 @override | 64 @override |
| 65 String toString() => name; | 65 String toString() => name; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, | 104 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, |
| 105 Map<String, dynamic> inputs) { | 105 Map<String, dynamic> inputs) { |
| 106 AnalysisTask task = buildTask(context, target); | 106 AnalysisTask task = buildTask(context, target); |
| 107 task.inputs = inputs; | 107 task.inputs = inputs; |
| 108 return task; | 108 return task; |
| 109 } | 109 } |
| 110 | 110 |
| 111 @override | 111 @override |
| 112 String toString() => name; | 112 String toString() => name; |
| 113 } | 113 } |
| OLD | NEW |