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

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: fix 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
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..ea5e336186968d63f22330f829f1b64fb5867fee 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. In case no
+ * state has been associated with the given [key], returns `null`.
scheglov 2015/10/14 18:20:04 Just curious - why "return" in one case but "retur
pquitslund 2015/10/14 22:31:46 Sloppy grammar on my part! Fixed.
+ *
+ * See [setConfigurationData]
scheglov 2015/10/14 18:20:04 Add dot?
pquitslund 2015/10/14 22:31:45 Done.
+ */
+ 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 =
+ <ResultDescriptor, Object>{};
scheglov 2015/10/14 18:20:04 new HashMap(), otherwise you get LInkedHashMap.
pquitslund 2015/10/14 22:31:46 Cool. Fixed. Thanks.
+
+ /**
* 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);
}

Powered by Google App Engine
This is Rietveld 408576698