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

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

Issue 660053002: Minor cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « no previous file | no next file » | 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 f95cd633cd68c51c78dddcebd7f783c13f62a99c..f821825bfb7cfc5ae0ded7314ecd2137acf95fae 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -11903,8 +11903,9 @@ class ResolutionState {
Source _librarySource;
/**
- * A table mapping data descriptors to the cached results for those
- * descriptors.
+ * A table mapping descriptors to the cached results for those descriptors.
+ * If there is no entry for a given descriptor then the state is implicitly
+ * [CacheState.INVALID] and the value is implicitly the default value.
*/
Map<DataDescriptor, CachedResult> resultMap
= new HashMap<DataDescriptor, CachedResult>();
@@ -12027,16 +12028,20 @@ class ResolutionState {
if (state == CacheState.VALID) {
throw new ArgumentError("use setValue() to set the state to VALID");
}
- CachedResult result = resultMap.putIfAbsent(
- descriptor,
- () => new CachedResult(descriptor));
- result.state = state;
- if (state != CacheState.IN_PROCESS) {
- //
- // If the state is in-process, we can leave the current value in the cache
- // for any 'get' methods to access.
- //
- result.value = descriptor.defaultValue;
+ if (state == CacheState.INVALID) {
+ resultMap.remove(descriptor);
+ } else {
+ CachedResult result = resultMap.putIfAbsent(
+ descriptor,
+ () => new CachedResult(descriptor));
+ result.state = state;
+ if (state != CacheState.IN_PROCESS) {
+ //
+ // If the state is in-process, we can leave the current value in the cache
+ // for any 'get' methods to access.
+ //
+ result.value = descriptor.defaultValue;
+ }
}
}
@@ -12132,7 +12137,7 @@ class ResolutionState {
buffer.write("; ");
buffer.write(label);
buffer.write(" = ");
- buffer.write(result == null ? "INVALID" : result.state);
+ buffer.write(result == null ? CacheState.INVALID : result.state);
}
}
@@ -13004,16 +13009,20 @@ abstract class SourceEntry {
throw new ArgumentError("use setValue() to set the state to VALID");
}
_validateStateChange(descriptor, state);
- CachedResult result = resultMap.putIfAbsent(
- descriptor,
- () => new CachedResult(descriptor));
- result.state = state;
- if (state != CacheState.IN_PROCESS) {
- //
- // If the state is in-process, we can leave the current value in the cache
- // for any 'get' methods to access.
- //
- result.value = descriptor.defaultValue;
+ if (state == CacheState.INVALID) {
+ resultMap.remove(descriptor);
+ } else {
+ CachedResult result = resultMap.putIfAbsent(
+ descriptor,
+ () => new CachedResult(descriptor));
+ result.state = state;
+ if (state != CacheState.IN_PROCESS) {
+ //
+ // If the state is in-process, we can leave the current value in the cache
+ // for any 'get' methods to access.
+ //
+ result.value = descriptor.defaultValue;
+ }
}
}
@@ -13156,7 +13165,7 @@ abstract class SourceEntry {
buffer.write("; ");
buffer.write(label);
buffer.write(" = ");
- buffer.write(result == null ? "INVALID" : result.state);
+ buffer.write(result == null ? CacheState.INVALID : result.state);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698