Index: pkg/analyzer/lib/src/generated/engine.dart |
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart |
index 57d35d91212d749e4133189ddc1390cfaf43d1d1..8729c2847fb2031082366b5aef587f7957711fca 100644 |
--- a/pkg/analyzer/lib/src/generated/engine.dart |
+++ b/pkg/analyzer/lib/src/generated/engine.dart |
@@ -514,9 +514,16 @@ abstract class AnalysisContext { |
bool isServerLibrary(Source librarySource); |
/** |
+ * Return the stream that is notified when a result with the given |
+ * [descriptor] is changed, e.g. computed or invalidated. |
+ */ |
+ Stream<ResultChangedEvent> onResultChanged(ResultDescriptor descriptor); |
+ |
+ /** |
* Return the stream that is notified when a new value for the given |
* [descriptor] is computed. |
*/ |
+ @deprecated |
Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor); |
/** |
@@ -545,7 +552,7 @@ abstract class AnalysisContext { |
* analysis results. This method can be long running. |
* |
* The implementation that uses the task model notifies subscribers of |
- * [onResultComputed] about computed results. |
+ * [onResultChanged] about computed results. |
* |
* The following results are computed for Dart sources. |
* |
@@ -1841,6 +1848,7 @@ class ChangeSet_ContentChange { |
/** |
* [ComputedResult] describes a value computed for a [ResultDescriptor]. |
*/ |
+@deprecated |
class ComputedResult<V> { |
/** |
* The context in which the value was computed. |
@@ -1865,7 +1873,7 @@ class ComputedResult<V> { |
ComputedResult(this.context, this.descriptor, this.target, this.value); |
@override |
- String toString() => '$descriptor of $target in $context'; |
+ String toString() => 'Computed $descriptor of $target in $context'; |
} |
/** |
@@ -2408,6 +2416,54 @@ class ResolutionEraser extends GeneralizingAstVisitor<Object> { |
} |
/** |
+ * [ResultChangedEvent] describes a change to an analysis result. |
+ */ |
+class ResultChangedEvent<V> { |
+ /** |
+ * The context in which the result was changed. |
+ */ |
+ final AnalysisContext context; |
+ |
+ /** |
+ * The target for which the result was changed. |
+ */ |
+ final AnalysisTarget target; |
+ |
+ /** |
+ * The descriptor of the result which was changed. |
+ */ |
+ final ResultDescriptor<V> descriptor; |
+ |
+ /** |
+ * If the result [wasComputed], the new value of the result. If the result |
+ * [wasInvalidated], the value of before it was invalidated, may be the |
+ * default value if the result was flushed. |
+ */ |
+ final V value; |
+ |
+ /** |
+ * Is `true` if the result was computed, or `false` is is was invalidated. |
+ */ |
+ final bool _wasComputed; |
+ |
+ ResultChangedEvent(this.context, this.target, this.descriptor, this.value, |
+ this._wasComputed); |
+ |
+ /** |
+ * Returns `true` if the result was computed. |
+ */ |
+ bool get wasComputed => _wasComputed; |
+ |
+ /** |
+ * Returns `true` if the result was invalidated. |
+ */ |
+ bool get wasInvalidated => !_wasComputed; |
+ |
+ @override |
+ String toString() => '$descriptor of $target'; |
Brian Wilkerson
2016/03/08 20:47:02
" in $context"?
scheglov
2016/03/08 20:53:46
Done.
|
+} |
+ |
+/** |
* [SourcesChangedEvent] indicates which sources have been added, removed, |
* or whose contents have changed. |
*/ |