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

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: Rename ResultComputedEvent -> ComputedResult. 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..0df224ce212c4494c4be74cbe2dd887d16333aa4 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<ComputedResult> 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,21 @@ 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]
+ *
+ * 2. For explicit sources:
+ * [DART_ERRORS].
+ *
+ * 3. For explicit and implicit library sources:
+ * [LIBRARY_ELEMENT].
*/
AnalysisResult performAnalysisTask();
@@ -2207,6 +2228,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor) {
+ throw new NotImplementedException('In not task-based AnalysisContext.');
+ }
+
+ @override
CompilationUnit parseCompilationUnit(Source source) =>
_getDartParseData2(source, DartEntry.PARSED_UNIT, null);
@@ -5729,7 +5755,7 @@ class AnalysisEngine {
* A flag indicating whether the (new) task model should be used to perform
* analysis.
*/
- bool useTaskModel = false;
+ bool useTaskModel = true;
/**
* The task manager used to manage the tasks used to analyze code.
@@ -7183,6 +7209,36 @@ class ChangeSet_ContentChange {
}
/**
+ * [ComputedResult] describes a value computed for a [ResultDescriptor].
+ */
+class ComputedResult<V> {
+ /**
+ * 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;
+
+ ComputedResult(this.context, this.descriptor, this.target, this.value);
+
+ @override
+ String toString() => '$descriptor of $target in $context';
+}
+
+/**
* A pair containing a library and a list of the (source, entry) pairs for
* compilation units in the library.
*/
« 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