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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 916973002: More complete state transition data (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 10921 matching lines...) Expand 10 before | Expand all | Expand 10 after
10932 } 10932 }
10933 } 10933 }
10934 10934
10935 /** 10935 /**
10936 * Set the value of the data represented by the given [descriptor] to the 10936 * Set the value of the data represented by the given [descriptor] to the
10937 * given [value]. 10937 * given [value].
10938 */ 10938 */
10939 void setValue(DataDescriptor /*<V>*/ descriptor, dynamic /*V*/ value) { 10939 void setValue(DataDescriptor /*<V>*/ descriptor, dynamic /*V*/ value) {
10940 CachedResult result = 10940 CachedResult result =
10941 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor)); 10941 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor));
10942 if (result.state == CacheState.FLUSHED) { 10942 SourceEntry.countTransition(descriptor, result);
10943 int count = SourceEntry.unflushedCountMap[descriptor];
10944 SourceEntry.unflushedCountMap[descriptor] = count == null ? 1 : count + 1;
10945 }
10946 result.state = CacheState.VALID; 10943 result.state = CacheState.VALID;
10947 result.value = value == null ? descriptor.defaultValue : value; 10944 result.value = value == null ? descriptor.defaultValue : value;
10948 } 10945 }
10949 10946
10950 /** 10947 /**
10951 * Flush the value of the data described by the [descriptor]. 10948 * Flush the value of the data described by the [descriptor].
10952 */ 10949 */
10953 void _flush(DataDescriptor descriptor) { 10950 void _flush(DataDescriptor descriptor) {
10954 CachedResult result = resultMap[descriptor]; 10951 CachedResult result = resultMap[descriptor];
10955 if (result != null && result.state == CacheState.VALID) { 10952 if (result != null && result.state == CacheState.VALID) {
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
11618 11615
11619 /** 11616 /**
11620 * The index of the flag indicating whether the source was explicitly added to 11617 * The index of the flag indicating whether the source was explicitly added to
11621 * the context or whether the source was implicitly added because it was 11618 * the context or whether the source was implicitly added because it was
11622 * referenced by another source. 11619 * referenced by another source.
11623 */ 11620 */
11624 static int _EXPLICITLY_ADDED_FLAG = 0; 11621 static int _EXPLICITLY_ADDED_FLAG = 0;
11625 11622
11626 /** 11623 /**
11627 * A table mapping data descriptors to a count of the number of times a value 11624 * A table mapping data descriptors to a count of the number of times a value
11628 * of that kind was flushed and then re-created. 11625 * was set when in a given state.
11629 */ 11626 */
11630 static final Map<DataDescriptor, int> unflushedCountMap = 11627 static final Map<DataDescriptor, Map<CacheState, int>> transitionMap =
11631 new HashMap<DataDescriptor, int>(); 11628 new HashMap<DataDescriptor, Map<CacheState, int>>();
11632 11629
11633 /** 11630 /**
11634 * The most recent time at which the state of the source matched the state 11631 * The most recent time at which the state of the source matched the state
11635 * represented by this entry. 11632 * represented by this entry.
11636 */ 11633 */
11637 int modificationTime = 0; 11634 int modificationTime = 0;
11638 11635
11639 /** 11636 /**
11640 * The exception that caused one or more values to have a state of 11637 * The exception that caused one or more values to have a state of
11641 * [CacheState.ERROR]. 11638 * [CacheState.ERROR].
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
11813 * Set the value of the data represented by the given [descriptor] to the 11810 * Set the value of the data represented by the given [descriptor] to the
11814 * given [value]. 11811 * given [value].
11815 */ 11812 */
11816 void setValue(DataDescriptor /*<V>*/ descriptor, dynamic /*V*/ value) { 11813 void setValue(DataDescriptor /*<V>*/ descriptor, dynamic /*V*/ value) {
11817 if (!_isValidDescriptor(descriptor)) { 11814 if (!_isValidDescriptor(descriptor)) {
11818 throw new ArgumentError("Invalid descriptor: $descriptor"); 11815 throw new ArgumentError("Invalid descriptor: $descriptor");
11819 } 11816 }
11820 _validateStateChange(descriptor, CacheState.VALID); 11817 _validateStateChange(descriptor, CacheState.VALID);
11821 CachedResult result = 11818 CachedResult result =
11822 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor)); 11819 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor));
11823 if (result.state == CacheState.FLUSHED) { 11820 countTransition(descriptor, result);
11824 int count = unflushedCountMap[descriptor];
11825 unflushedCountMap[descriptor] = count == null ? 1 : count + 1;
11826 }
11827 result.state = CacheState.VALID; 11821 result.state = CacheState.VALID;
11828 result.value = value == null ? descriptor.defaultValue : value; 11822 result.value = value == null ? descriptor.defaultValue : value;
11829 } 11823 }
11830 11824
11825 /**
11826 * Increment the count of the number of times that data represented by the
11827 * given [descriptor] was transitioned from the current state (as found in the
11828 * given [result] to a valid state.
11829 */
11830 static void countTransition(DataDescriptor descriptor, CachedResult result) {
11831 Map<CacheState, int> countMap =
11832 transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int> ());
11833 int count = countMap[result.state];
11834 countMap[result.state] = count == null ? 1 : count + 1;
11835 }
11836
11831 @override 11837 @override
11832 String toString() { 11838 String toString() {
11833 StringBuffer buffer = new StringBuffer(); 11839 StringBuffer buffer = new StringBuffer();
11834 _writeOn(buffer); 11840 _writeOn(buffer);
11835 return buffer.toString(); 11841 return buffer.toString();
11836 } 11842 }
11837 11843
11838 /** 11844 /**
11839 * Flush the value of the data described by the [descriptor]. 11845 * Flush the value of the data described by the [descriptor].
11840 */ 11846 */
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
12398 if (element.id == _id) { 12404 if (element.id == _id) {
12399 result = element; 12405 result = element;
12400 throw new _ElementByIdFinderException(); 12406 throw new _ElementByIdFinderException();
12401 } 12407 }
12402 super.visitElement(element); 12408 super.visitElement(element);
12403 } 12409 }
12404 } 12410 }
12405 12411
12406 class _ElementByIdFinderException { 12412 class _ElementByIdFinderException {
12407 } 12413 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698