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

Side by Side Diff: pkg/analyzer/lib/src/context/cache.dart

Issue 1355503004: Fix for updating HINTS during incremental resolution with TM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.src.context.cache; 5 library analyzer.src.context.cache;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 ResultData data = getResultData(descriptor); 486 ResultData data = getResultData(descriptor);
487 _setDependedOnResults(data, thisResult, dependedOn); 487 _setDependedOnResults(data, thisResult, dependedOn);
488 data.state = CacheState.VALID; 488 data.state = CacheState.VALID;
489 data.value = value == null ? descriptor.defaultValue : value; 489 data.value = value == null ? descriptor.defaultValue : value;
490 } 490 }
491 491
492 /** 492 /**
493 * Set the value of the result represented by the given [descriptor] to the 493 * Set the value of the result represented by the given [descriptor] to the
494 * given [value], keep its dependency, invalidate all the dependent result. 494 * given [value], keep its dependency, invalidate all the dependent result.
495 */ 495 */
496 void setValueIncremental(ResultDescriptor descriptor, dynamic value) { 496 void setValueIncremental(
497 ResultDescriptor descriptor, dynamic value, bool invalidateDependent) {
497 ResultData data = getResultData(descriptor); 498 ResultData data = getResultData(descriptor);
498 _invalidateDependentResults(null, data, null, 0);
499 data.state = CacheState.VALID; 499 data.state = CacheState.VALID;
500 data.value = value; 500 data.value = value;
501 if (invalidateDependent) {
502 _invalidateDependentResults(null, data, null, 0);
503 }
501 } 504 }
502 505
503 @override 506 @override
504 String toString() { 507 String toString() {
505 StringBuffer buffer = new StringBuffer(); 508 StringBuffer buffer = new StringBuffer();
506 _writeOn(buffer); 509 _writeOn(buffer);
507 return buffer.toString(); 510 return buffer.toString();
508 } 511 }
509 512
510 /** 513 /**
(...skipping 19 matching lines...) Expand all
530 thisData.invalidateId = id; 533 thisData.invalidateId = id;
531 } 534 }
532 // Ask the delta to validate. 535 // Ask the delta to validate.
533 DeltaResult deltaResult = null; 536 DeltaResult deltaResult = null;
534 if (delta != null) { 537 if (delta != null) {
535 deltaResult = delta.validate(_partition.context, target, descriptor); 538 deltaResult = delta.validate(_partition.context, target, descriptor);
536 if (deltaResult == DeltaResult.STOP) { 539 if (deltaResult == DeltaResult.STOP) {
537 return; 540 return;
538 } 541 }
539 } 542 }
540 if (deltaResult == null || deltaResult == DeltaResult.INVALIDATE) { 543 if (deltaResult == DeltaResult.INVALIDATE_NO_DELTA) {
544 delta = null;
545 }
546 if (deltaResult == null ||
547 deltaResult == DeltaResult.INVALIDATE ||
548 deltaResult == DeltaResult.INVALIDATE_NO_DELTA) {
541 _resultMap.remove(descriptor); 549 _resultMap.remove(descriptor);
542 // { 550 // {
543 // String indent = ' ' * level; 551 // String indent = ' ' * level;
544 // print('[$id]$indent invalidate $descriptor for $target'); 552 // print('[$id]$indent invalidate $descriptor for $target');
545 // } 553 // }
546 } 554 }
547 // Stop depending on other results. 555 // Stop depending on other results.
548 TargetedResult thisResult = new TargetedResult(target, descriptor); 556 TargetedResult thisResult = new TargetedResult(target, descriptor);
549 for (TargetedResult dependedOnResult in thisData.dependedOnResults) { 557 for (TargetedResult dependedOnResult in thisData.dependedOnResults) {
550 ResultData data = _partition._getDataFor(dependedOnResult); 558 ResultData data = _partition._getDataFor(dependedOnResult);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 */ 1036 */
1029 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, 1037 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target,
1030 ResultDescriptor descriptor) { 1038 ResultDescriptor descriptor) {
1031 return DeltaResult.INVALIDATE; 1039 return DeltaResult.INVALIDATE;
1032 } 1040 }
1033 } 1041 }
1034 1042
1035 /** 1043 /**
1036 * The possible results of validating analysis results againt a [Delta]. 1044 * The possible results of validating analysis results againt a [Delta].
1037 */ 1045 */
1038 enum DeltaResult { INVALIDATE, KEEP_CONTINUE, STOP } 1046 enum DeltaResult {
1047 /**
1048 * Invalidate this result and continue visiting dependent results
1049 * with this [Delta].
1050 */
1051 INVALIDATE,
1052
1053 /**
1054 * Invalidate this result and stop using this [Delta], so unconditionally
1055 * invalidate all the dependent results.
1056 */
1057 INVALIDATE_NO_DELTA,
1058
1059 /**
1060 * Keep this result and continue validating dependent results
1061 * with this [Delta].
1062 */
1063 KEEP_CONTINUE,
1064
1065 /**
1066 * Keep this result and stop visiting results that depend on this one.
1067 */
1068 STOP
1069 }
1039 1070
1040 /** 1071 /**
1041 * [InvalidatedResult] describes an invalidated result. 1072 * [InvalidatedResult] describes an invalidated result.
1042 */ 1073 */
1043 class InvalidatedResult { 1074 class InvalidatedResult {
1044 /** 1075 /**
1045 * The target in which the result was invalidated. 1076 * The target in which the result was invalidated.
1046 */ 1077 */
1047 final CacheEntry entry; 1078 final CacheEntry entry;
1048 1079
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 void resultAccessed(TargetedResult result) {} 1225 void resultAccessed(TargetedResult result) {}
1195 1226
1196 @override 1227 @override
1197 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { 1228 List<TargetedResult> resultStored(TargetedResult newResult, newValue) {
1198 return TargetedResult.EMPTY_LIST; 1229 return TargetedResult.EMPTY_LIST;
1199 } 1230 }
1200 1231
1201 @override 1232 @override
1202 void targetRemoved(AnalysisTarget target) {} 1233 void targetRemoved(AnalysisTarget target) {}
1203 } 1234 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698