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

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

Issue 683673004: Fix issue 21379 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | pkg/analyzer/test/generated/engine_test.dart » ('j') | 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 8019 matching lines...) Expand 10 before | Expand all | Expand 10 after
8030 if (getState(PARSED_UNIT) == CacheState.VALID) { 8030 if (getState(PARSED_UNIT) == CacheState.VALID) {
8031 CompilationUnit unit = getValue(PARSED_UNIT); 8031 CompilationUnit unit = getValue(PARSED_UNIT);
8032 setState(PARSED_UNIT, CacheState.FLUSHED); 8032 setState(PARSED_UNIT, CacheState.FLUSHED);
8033 return unit; 8033 return unit;
8034 } 8034 }
8035 ResolutionState state = _resolutionState; 8035 ResolutionState state = _resolutionState;
8036 while (state != null) { 8036 while (state != null) {
8037 if (state.getState(BUILT_UNIT) == CacheState.VALID) { 8037 if (state.getState(BUILT_UNIT) == CacheState.VALID) {
8038 // TODO(brianwilkerson) We're cloning the structure to remove any 8038 // TODO(brianwilkerson) We're cloning the structure to remove any
8039 // previous resolution data, but I'm not sure that's necessary. 8039 // previous resolution data, but I'm not sure that's necessary.
8040 return state.getValue(BUILT_UNIT).accept(new AstCloner()) as Compilation Unit; 8040 return state.getValue(BUILT_UNIT).accept(new AstCloner());
8041 } 8041 }
8042 if (state.getState(RESOLVED_UNIT) == CacheState.VALID) { 8042 if (state.getState(RESOLVED_UNIT) == CacheState.VALID) {
8043 return state.getValue(RESOLVED_UNIT).accept(new AstCloner()) as Compilat ionUnit; 8043 return state.getValue(RESOLVED_UNIT).accept(new AstCloner());
8044 } 8044 }
8045 state = state._nextState; 8045 state = state._nextState;
8046 } 8046 }
8047 return null; 8047 return null;
8048 } 8048 }
8049 8049
8050 /** 8050 /**
8051 * Return the state of the data represented by the given [descriptor] in the 8051 * Return the state of the data represented by the given [descriptor] in the
8052 * context of the given [librarySource]. 8052 * context of the given [librarySource].
8053 */ 8053 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
8140 /** 8140 /**
8141 * Invalidate all of the resolution information associated with the 8141 * Invalidate all of the resolution information associated with the
8142 * compilation unit. The flag [invalidateUris] should be `true` if the cached 8142 * compilation unit. The flag [invalidateUris] should be `true` if the cached
8143 * results of converting URIs to source files should also be invalidated. 8143 * results of converting URIs to source files should also be invalidated.
8144 */ 8144 */
8145 void invalidateAllResolutionInformation(bool invalidateUris) { 8145 void invalidateAllResolutionInformation(bool invalidateUris) {
8146 if (getState(PARSED_UNIT) == CacheState.FLUSHED) { 8146 if (getState(PARSED_UNIT) == CacheState.FLUSHED) {
8147 ResolutionState state = _resolutionState; 8147 ResolutionState state = _resolutionState;
8148 while (state != null) { 8148 while (state != null) {
8149 if (state.getState(BUILT_UNIT) == CacheState.VALID) { 8149 if (state.getState(BUILT_UNIT) == CacheState.VALID) {
8150 setValue(PARSED_UNIT, state.getValue(BUILT_UNIT)); 8150 CompilationUnit unit = state.getValue(BUILT_UNIT);
8151 ResolutionEraser.erase(unit);
8152 setValue(PARSED_UNIT, unit);
8151 break; 8153 break;
8152 } else if (state.getState(RESOLVED_UNIT) == CacheState.VALID) { 8154 } else if (state.getState(RESOLVED_UNIT) == CacheState.VALID) {
8153 setValue(PARSED_UNIT, state.getValue(RESOLVED_UNIT)); 8155 CompilationUnit unit = state.getValue(RESOLVED_UNIT);
8156 ResolutionEraser.erase(unit);
8157 setValue(PARSED_UNIT, unit);
8154 break; 8158 break;
8155 } 8159 }
8156 state = state._nextState; 8160 state = state._nextState;
8157 } 8161 }
8158 } 8162 }
8159 _discardCachedResolutionInformation(invalidateUris); 8163 _discardCachedResolutionInformation(invalidateUris);
8160 } 8164 }
8161 8165
8162 /** 8166 /**
8163 * Return `true` if this data is safe to use in refactoring. 8167 * Return `true` if this data is safe to use in refactoring.
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after
11791 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { 11795 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) {
11792 CompilationUnit script = node.script; 11796 CompilationUnit script = node.script;
11793 if (script != null) { 11797 if (script != null) {
11794 GenerateDartErrorsTask.validateDirectives(ResolveHtmlTask_this.context, Re solveHtmlTask_this.source, script, errorListener); 11798 GenerateDartErrorsTask.validateDirectives(ResolveHtmlTask_this.context, Re solveHtmlTask_this.source, script, errorListener);
11795 } 11799 }
11796 return null; 11800 return null;
11797 } 11801 }
11798 } 11802 }
11799 11803
11800 /** 11804 /**
11801 * Instances of the class `ResolutionEraser` remove any resolution information f rom an AST 11805 * A `ResolutionEraser` removes any resolution information from an AST
11802 * structure when used to visit that structure. 11806 * structure when used to visit that structure.
11803 */ 11807 */
11804 class ResolutionEraser extends GeneralizingAstVisitor<Object> { 11808 class ResolutionEraser extends GeneralizingAstVisitor<Object> {
11809 /**
11810 * Remove any resolution information from the given AST structure.
11811 */
11812 static void erase(AstNode node) {
11813 node.accept(new ResolutionEraser());
11814 }
11815
11805 @override 11816 @override
11806 Object visitAssignmentExpression(AssignmentExpression node) { 11817 Object visitAssignmentExpression(AssignmentExpression node) {
11807 node.staticElement = null; 11818 node.staticElement = null;
11808 node.propagatedElement = null; 11819 node.propagatedElement = null;
11809 return super.visitAssignmentExpression(node); 11820 return super.visitAssignmentExpression(node);
11810 } 11821 }
11811 11822
11812 @override 11823 @override
11813 Object visitBinaryExpression(BinaryExpression node) { 11824 Object visitBinaryExpression(BinaryExpression node) {
11814 node.staticElement = null; 11825 node.staticElement = null;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
11977 } 11988 }
11978 return false; 11989 return false;
11979 } 11990 }
11980 11991
11981 /** 11992 /**
11982 * Invalidate all of the resolution information associated with the compilatio n unit. 11993 * Invalidate all of the resolution information associated with the compilatio n unit.
11983 */ 11994 */
11984 void invalidateAllResolutionInformation() { 11995 void invalidateAllResolutionInformation() {
11985 _nextState = null; 11996 _nextState = null;
11986 _librarySource = null; 11997 _librarySource = null;
11998 setState(DartEntry.BUILT_UNIT, CacheState.INVALID);
11999 setState(DartEntry.BUILT_ELEMENT, CacheState.INVALID);
12000 setState(DartEntry.HINTS, CacheState.INVALID);
11987 setState(DartEntry.RESOLVED_UNIT, CacheState.INVALID); 12001 setState(DartEntry.RESOLVED_UNIT, CacheState.INVALID);
11988 setState(DartEntry.RESOLUTION_ERRORS, CacheState.INVALID); 12002 setState(DartEntry.RESOLUTION_ERRORS, CacheState.INVALID);
11989 setState(DartEntry.VERIFICATION_ERRORS, CacheState.INVALID); 12003 setState(DartEntry.VERIFICATION_ERRORS, CacheState.INVALID);
11990 setState(DartEntry.HINTS, CacheState.INVALID);
11991 } 12004 }
11992 12005
11993 /** 12006 /**
11994 * Record that an exception occurred while attempting to build the element 12007 * Record that an exception occurred while attempting to build the element
11995 * model for the source associated with this state. 12008 * model for the source associated with this state.
11996 */ 12009 */
11997 void recordBuildElementError() { 12010 void recordBuildElementError() {
11998 setState(DartEntry.BUILT_UNIT, CacheState.ERROR); 12011 setState(DartEntry.BUILT_UNIT, CacheState.ERROR);
11999 setState(DartEntry.BUILT_ELEMENT, CacheState.ERROR); 12012 setState(DartEntry.BUILT_ELEMENT, CacheState.ERROR);
12000 recordResolutionError(); 12013 recordResolutionError();
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
13033 _validateStateChange(descriptor, state); 13046 _validateStateChange(descriptor, state);
13034 if (state == CacheState.INVALID) { 13047 if (state == CacheState.INVALID) {
13035 resultMap.remove(descriptor); 13048 resultMap.remove(descriptor);
13036 } else { 13049 } else {
13037 CachedResult result = resultMap.putIfAbsent( 13050 CachedResult result = resultMap.putIfAbsent(
13038 descriptor, 13051 descriptor,
13039 () => new CachedResult(descriptor)); 13052 () => new CachedResult(descriptor));
13040 result.state = state; 13053 result.state = state;
13041 if (state != CacheState.IN_PROCESS) { 13054 if (state != CacheState.IN_PROCESS) {
13042 // 13055 //
13043 // If the state is in-process, we can leave the current value in the cac he 13056 // If the state is in-process, we can leave the current value in the
13044 // for any 'get' methods to access. 13057 // cache for any 'get' methods to access.
13045 // 13058 //
13046 result.value = descriptor.defaultValue; 13059 result.value = descriptor.defaultValue;
13047 } 13060 }
13048 } 13061 }
13049 } 13062 }
13050 13063
13051 /** 13064 /**
13052 * Set the value of the data represented by the given [descriptor] to the 13065 * Set the value of the data represented by the given [descriptor] to the
13053 * given [value]. 13066 * given [value].
13054 */ 13067 */
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
13502 _index++; 13515 _index++;
13503 if (_index >= _manager._workQueues[_queueIndex].length) { 13516 if (_index >= _manager._workQueues[_queueIndex].length) {
13504 _index = 0; 13517 _index = 0;
13505 _queueIndex++; 13518 _queueIndex++;
13506 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13519 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13507 _queueIndex++; 13520 _queueIndex++;
13508 } 13521 }
13509 } 13522 }
13510 } 13523 }
13511 } 13524 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698