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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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:collection'; 10 import 'dart:collection';
(...skipping 11885 matching lines...) Expand 10 before | Expand all | Expand 10 after
11896 ResolutionState _nextState; 11896 ResolutionState _nextState;
11897 11897
11898 /** 11898 /**
11899 * The source for the defining compilation unit of the library that contains t his unit. If this 11899 * The source for the defining compilation unit of the library that contains t his unit. If this
11900 * unit is the defining compilation unit for it's library, then this will be t he source for this 11900 * unit is the defining compilation unit for it's library, then this will be t he source for this
11901 * unit. 11901 * unit.
11902 */ 11902 */
11903 Source _librarySource; 11903 Source _librarySource;
11904 11904
11905 /** 11905 /**
11906 * A table mapping data descriptors to the cached results for those 11906 * A table mapping descriptors to the cached results for those descriptors.
11907 * descriptors. 11907 * If there is no entry for a given descriptor then the state is implicitly
11908 * [CacheState.INVALID] and the value is implicitly the default value.
11908 */ 11909 */
11909 Map<DataDescriptor, CachedResult> resultMap 11910 Map<DataDescriptor, CachedResult> resultMap
11910 = new HashMap<DataDescriptor, CachedResult>(); 11911 = new HashMap<DataDescriptor, CachedResult>();
11911 11912
11912 /** 11913 /**
11913 * Flush any AST structures being maintained by this state. 11914 * Flush any AST structures being maintained by this state.
11914 */ 11915 */
11915 void flushAstStructures() { 11916 void flushAstStructures() {
11916 _flush(DartEntry.BUILT_UNIT); 11917 _flush(DartEntry.BUILT_UNIT);
11917 _flush(DartEntry.RESOLVED_UNIT); 11918 _flush(DartEntry.RESOLVED_UNIT);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
12020 } 12021 }
12021 12022
12022 /** 12023 /**
12023 * Set the state of the data represented by the given [descriptor] to the 12024 * Set the state of the data represented by the given [descriptor] to the
12024 * given [state]. 12025 * given [state].
12025 */ 12026 */
12026 void setState(DataDescriptor descriptor, CacheState state) { 12027 void setState(DataDescriptor descriptor, CacheState state) {
12027 if (state == CacheState.VALID) { 12028 if (state == CacheState.VALID) {
12028 throw new ArgumentError("use setValue() to set the state to VALID"); 12029 throw new ArgumentError("use setValue() to set the state to VALID");
12029 } 12030 }
12030 CachedResult result = resultMap.putIfAbsent( 12031 if (state == CacheState.INVALID) {
12031 descriptor, 12032 resultMap.remove(descriptor);
12032 () => new CachedResult(descriptor)); 12033 } else {
12033 result.state = state; 12034 CachedResult result = resultMap.putIfAbsent(
12034 if (state != CacheState.IN_PROCESS) { 12035 descriptor,
12035 // 12036 () => new CachedResult(descriptor));
12036 // If the state is in-process, we can leave the current value in the cache 12037 result.state = state;
12037 // for any 'get' methods to access. 12038 if (state != CacheState.IN_PROCESS) {
12038 // 12039 //
12039 result.value = descriptor.defaultValue; 12040 // If the state is in-process, we can leave the current value in the cac he
12041 // for any 'get' methods to access.
12042 //
12043 result.value = descriptor.defaultValue;
12044 }
12040 } 12045 }
12041 } 12046 }
12042 12047
12043 /** 12048 /**
12044 * Set the value of the data represented by the given [descriptor] to the 12049 * Set the value of the data represented by the given [descriptor] to the
12045 * given [value]. 12050 * given [value].
12046 */ 12051 */
12047 void setValue(DataDescriptor/*<V>*/ descriptor, dynamic /*V*/ value) { 12052 void setValue(DataDescriptor/*<V>*/ descriptor, dynamic /*V*/ value) {
12048 CachedResult result = resultMap.putIfAbsent( 12053 CachedResult result = resultMap.putIfAbsent(
12049 descriptor, 12054 descriptor,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
12125 /** 12130 /**
12126 * Write a textual representation of the state of the value described by the 12131 * Write a textual representation of the state of the value described by the
12127 * given [descriptor] to the given bugger, prefixed by the given [label] to 12132 * given [descriptor] to the given bugger, prefixed by the given [label] to
12128 * the given [buffer]. 12133 * the given [buffer].
12129 */ 12134 */
12130 void _writeStateOn(StringBuffer buffer, String label, DataDescriptor descripto r) { 12135 void _writeStateOn(StringBuffer buffer, String label, DataDescriptor descripto r) {
12131 CachedResult result = resultMap[descriptor]; 12136 CachedResult result = resultMap[descriptor];
12132 buffer.write("; "); 12137 buffer.write("; ");
12133 buffer.write(label); 12138 buffer.write(label);
12134 buffer.write(" = "); 12139 buffer.write(" = ");
12135 buffer.write(result == null ? "INVALID" : result.state); 12140 buffer.write(result == null ? CacheState.INVALID : result.state);
12136 } 12141 }
12137 } 12142 }
12138 12143
12139 /** 12144 /**
12140 * A `ResolvableCompilationUnit` is a compilation unit that is not referenced by 12145 * A `ResolvableCompilationUnit` is a compilation unit that is not referenced by
12141 * any other objects. It is used by the [LibraryResolver] to resolve a library. 12146 * any other objects. It is used by the [LibraryResolver] to resolve a library.
12142 */ 12147 */
12143 class ResolvableCompilationUnit { 12148 class ResolvableCompilationUnit {
12144 /** 12149 /**
12145 * The source of the compilation unit. 12150 * The source of the compilation unit.
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
12997 * given [state]. 13002 * given [state].
12998 */ 13003 */
12999 void setState(DataDescriptor descriptor, CacheState state) { 13004 void setState(DataDescriptor descriptor, CacheState state) {
13000 if (!_isValidDescriptor(descriptor)) { 13005 if (!_isValidDescriptor(descriptor)) {
13001 throw new ArgumentError("Invalid descriptor: $descriptor"); 13006 throw new ArgumentError("Invalid descriptor: $descriptor");
13002 } 13007 }
13003 if (state == CacheState.VALID) { 13008 if (state == CacheState.VALID) {
13004 throw new ArgumentError("use setValue() to set the state to VALID"); 13009 throw new ArgumentError("use setValue() to set the state to VALID");
13005 } 13010 }
13006 _validateStateChange(descriptor, state); 13011 _validateStateChange(descriptor, state);
13007 CachedResult result = resultMap.putIfAbsent( 13012 if (state == CacheState.INVALID) {
13008 descriptor, 13013 resultMap.remove(descriptor);
13009 () => new CachedResult(descriptor)); 13014 } else {
13010 result.state = state; 13015 CachedResult result = resultMap.putIfAbsent(
13011 if (state != CacheState.IN_PROCESS) { 13016 descriptor,
13012 // 13017 () => new CachedResult(descriptor));
13013 // If the state is in-process, we can leave the current value in the cache 13018 result.state = state;
13014 // for any 'get' methods to access. 13019 if (state != CacheState.IN_PROCESS) {
13015 // 13020 //
13016 result.value = descriptor.defaultValue; 13021 // If the state is in-process, we can leave the current value in the cac he
13022 // for any 'get' methods to access.
13023 //
13024 result.value = descriptor.defaultValue;
13025 }
13017 } 13026 }
13018 } 13027 }
13019 13028
13020 /** 13029 /**
13021 * Set the value of the data represented by the given [descriptor] to the 13030 * Set the value of the data represented by the given [descriptor] to the
13022 * given [value]. 13031 * given [value].
13023 */ 13032 */
13024 void setValue(DataDescriptor/*<V>*/ descriptor, dynamic /*V*/ value) { 13033 void setValue(DataDescriptor/*<V>*/ descriptor, dynamic /*V*/ value) {
13025 if (!_isValidDescriptor(descriptor)) { 13034 if (!_isValidDescriptor(descriptor)) {
13026 throw new ArgumentError("Invalid descriptor: $descriptor"); 13035 throw new ArgumentError("Invalid descriptor: $descriptor");
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
13149 /** 13158 /**
13150 * Write a textual representation of the state of the value described by the 13159 * Write a textual representation of the state of the value described by the
13151 * given [descriptor] to the given bugger, prefixed by the given [label] to 13160 * given [descriptor] to the given bugger, prefixed by the given [label] to
13152 * the given [buffer]. 13161 * the given [buffer].
13153 */ 13162 */
13154 void _writeStateOn(StringBuffer buffer, String label, DataDescriptor descripto r) { 13163 void _writeStateOn(StringBuffer buffer, String label, DataDescriptor descripto r) {
13155 CachedResult result = resultMap[descriptor]; 13164 CachedResult result = resultMap[descriptor];
13156 buffer.write("; "); 13165 buffer.write("; ");
13157 buffer.write(label); 13166 buffer.write(label);
13158 buffer.write(" = "); 13167 buffer.write(" = ");
13159 buffer.write(result == null ? "INVALID" : result.state); 13168 buffer.write(result == null ? CacheState.INVALID : result.state);
13160 } 13169 }
13161 13170
13162 /** 13171 /**
13163 * If the state of the value described by the given [descriptor] is changing 13172 * If the state of the value described by the given [descriptor] is changing
13164 * from ERROR to anything else, capture the information. This is an attempt to 13173 * from ERROR to anything else, capture the information. This is an attempt to
13165 * discover the underlying cause of a long-standing bug. 13174 * discover the underlying cause of a long-standing bug.
13166 */ 13175 */
13167 void _validateStateChange(DataDescriptor descriptor, CacheState newState) { 13176 void _validateStateChange(DataDescriptor descriptor, CacheState newState) {
13168 if (descriptor != CONTENT) { 13177 if (descriptor != CONTENT) {
13169 return; 13178 return;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
13471 _index++; 13480 _index++;
13472 if (_index >= _manager._workQueues[_queueIndex].length) { 13481 if (_index >= _manager._workQueues[_queueIndex].length) {
13473 _index = 0; 13482 _index = 0;
13474 _queueIndex++; 13483 _queueIndex++;
13475 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13484 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13476 _queueIndex++; 13485 _queueIndex++;
13477 } 13486 }
13478 } 13487 }
13479 } 13488 }
13480 } 13489 }
OLDNEW
« 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