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

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

Issue 1403033002: State-carrying context API. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixes and tests. Created 5 years, 2 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/test/generated/engine_test.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 7ec28c5793280c0b899a70607590afc5c110eea5..1531cf31655b41f12d5d7cf079604455d13ba6d1 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -590,6 +590,14 @@ abstract class AnalysisContext {
Source unitSource, Source librarySource);
/**
+ * Return configuration data associated with the given key or `null` if no
+ * state has been associated with the given [key].
+ *
+ * See [setConfigurationData].
+ */
+ Object getConfigurationData(ResultDescriptor key);
+
+ /**
* Return the contents and timestamp of the given [source].
*
* This method should be used rather than the method [Source.getContents]
@@ -886,6 +894,13 @@ abstract class AnalysisContext {
Source source, String contents, int offset, int oldLength, int newLength);
/**
+ * Associate this configuration [data] object with the given descriptor [key].
+ *
+ * See [getConfigurationData].
+ */
+ void setConfigurationData(ResultDescriptor key, Object data);
+
+ /**
* Set the contents of the given [source] to the given [contents] and mark the
* source as having changed. This has the effect of overriding the default
* contents of the source. If the contents are `null` the override is removed
@@ -938,6 +953,12 @@ class AnalysisContextImpl implements InternalAnalysisContext {
String name;
/**
+ * Configuration data associated with this context.
+ */
+ final HashMap<ResultDescriptor, Object> _configurationData =
+ new HashMap<ResultDescriptor, Object>();
+
+ /**
* The set of analysis options controlling the behavior of this context.
*/
AnalysisOptionsImpl _options = new AnalysisOptionsImpl();
@@ -1940,6 +1961,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ Object getConfigurationData(ResultDescriptor key) => _configurationData[key];
+
+ @override
TimestampedData<String> getContents(Source source) {
String contents = _contentCache.getContents(source);
if (contents != null) {
@@ -2636,6 +2660,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ void setConfigurationData(ResultDescriptor key, Object data) {
+ _configurationData[key] = data;
+ }
+
+ @override
void setContents(Source source, String contents) {
_contentsChanged(source, contents, true);
}
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698