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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1181603004: Add AnalysisContext.onResultComputed(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac74c02f0c488c563dab90e90252e11e040da509..29d755d42bce7c14210f60e9e525295d3f5ac6c4 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -742,6 +742,12 @@ abstract class AnalysisContext {
bool isServerLibrary(Source librarySource);
/**
+ * Return the stream that is notified when a new value for the given
+ * [descriptor] is computed.
+ */
+ Stream<ResultComputedEvent> onResultComputed(ResultDescriptor descriptor);
+
+ /**
* Parse the content of the given [source] to produce an AST structure. The
* resulting AST structure may or may not be resolved, and may have a slightly
* different structure depending upon whether it is resolved.
@@ -767,6 +773,22 @@ abstract class AnalysisContext {
* Perform the next unit of work required to keep the analysis results
* up-to-date and return information about the consequent changes to the
* analysis results. This method can be long running.
+ *
+ * The implementation that uses the task model notifies subscribers of
+ * [onResultComputed] about computed results.
+ *
+ * The following results are computed for Dart sources.
+ *
+ * 1. For explicit and implicit sources:
+ * [PARSED_UNIT]
+ * [RESOLVED_UNIT_NO_CONSTANTS].
+ *
+ * 2. For explicit sources:
+ * [RESOLVED_UNIT]
+ * [DART_ERRORS].
+ *
+ * 3. For explicit and implicit library sources:
+ * [LIBRARY_ELEMENT].
*/
AnalysisResult performAnalysisTask();
@@ -2207,6 +2229,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ Stream<ResultComputedEvent> onResultComputed(ResultDescriptor descriptor) {
+ throw new NotImplementedException('In not task-based AnalysisContext.');
+ }
+
+ @override
CompilationUnit parseCompilationUnit(Source source) =>
_getDartParseData2(source, DartEntry.PARSED_UNIT, null);
@@ -10756,6 +10783,36 @@ class ResolveHtmlTask extends AnalysisTask {
}
/**
+ * [ResultComputedEvent] describes a value computed for a [ResultDescriptor].
+ */
+class ResultComputedEvent<V> {
Brian Wilkerson 2015/06/11 16:44:44 Perhaps "ComputedResult"?
scheglov 2015/06/11 17:43:25 Done.
+ /**
+ * The context in which the value was computed.
+ */
+ final AnalysisContext context;
+
+ /**
+ * The descriptor of the result which was computed.
+ */
+ final ResultDescriptor<V> descriptor;
+
+ /**
+ * The target for which the result was computed.
+ */
+ final AnalysisTarget target;
+
+ /**
+ * The computed value.
+ */
+ final V value;
+
+ ResultComputedEvent(this.context, this.descriptor, this.target, this.value);
+
+ @override
+ String toString() => '$descriptor of $target in $context';
+}
+
+/**
* The priority of data in the cache in terms of the desirability of retaining
* some specified data about a specified source.
*/
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698