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

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

Issue 2266403008: Fix couple problems with in-body incremental resolution. (Closed)
Patch Set: Actual changes. Created 4 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/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 * Visit the given [result] and all results that depend on it, and 610 * Visit the given [result] and all results that depend on it, and
611 * ask [delta] to gather changes. Return `true` if the [delta] can be used 611 * ask [delta] to gather changes. Return `true` if the [delta] can be used
612 * to perform limited invalidation, or `false` if the changes collection 612 * to perform limited invalidation, or `false` if the changes collection
613 * process does not stop (should not happen). 613 * process does not stop (should not happen).
614 */ 614 */
615 bool _gatherResultsInvalidatedByDelta( 615 bool _gatherResultsInvalidatedByDelta(
616 ResultDescriptor result, Delta delta, int level) { 616 ResultDescriptor result, Delta delta, int level) {
617 if (delta == null) { 617 if (delta == null) {
618 return false; 618 return false;
619 } 619 }
620 if (!delta.gatherRequired()) {
621 return true;
622 }
620 for (int i = 0; i < 64; i++) { 623 for (int i = 0; i < 64; i++) {
621 bool hasVisitChanges = false; 624 bool hasVisitChanges = false;
622 _visitResults(nextVisitId++, result, 625 _visitResults(nextVisitId++, result,
623 (AnalysisTarget target, ResultData data) { 626 (AnalysisTarget target, ResultData data) {
624 bool hasDeltaChanges = delta.gatherChanges( 627 bool hasDeltaChanges = delta.gatherChanges(
625 _partition.context, target, data.descriptor, data.value); 628 _partition.context, target, data.descriptor, data.value);
626 if (hasDeltaChanges) { 629 if (hasDeltaChanges) {
627 hasVisitChanges = true; 630 hasVisitChanges = true;
628 } 631 }
629 }); 632 });
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 } 1251 }
1249 1252
1250 /** 1253 /**
1251 * The description for a change. 1254 * The description for a change.
1252 */ 1255 */
1253 class Delta { 1256 class Delta {
1254 final Source source; 1257 final Source source;
1255 1258
1256 Delta(this.source); 1259 Delta(this.source);
1257 1260
1261 /**
1262 * This method is called during a cache walk, so that the delta can gather
1263 * additional changes to which are caused by the changes it already knows
1264 * about. Return `true` if a new change was added, so that one more cache
1265 * walk will be performed (to include changes that depend on results which we
1266 * decided to be changed later in the previous cache walk).
1267 */
1258 bool gatherChanges(InternalAnalysisContext context, AnalysisTarget target, 1268 bool gatherChanges(InternalAnalysisContext context, AnalysisTarget target,
1259 ResultDescriptor descriptor, Object value) { 1269 ResultDescriptor descriptor, Object value) {
1260 return false; 1270 return false;
1261 } 1271 }
1262 1272
1263 /** 1273 /**
1264 * The current cache results visit is done. 1274 * The current cache results visit is done.
1265 */ 1275 */
1266 void gatherEnd() {} 1276 void gatherEnd() {}
1267 1277
1268 /** 1278 /**
1279 * Return `true` if this delta needs cache walking to gather additional
1280 * changes before it can be used to [validate]. In this case [gatherChanges]
1281 * is invoked for every targeted result in transitive dependencies, and
1282 * [gatherEnd] is invoked after cache walking is done.
1283 */
1284 bool gatherRequired() {
Brian Wilkerson 2016/08/25 18:57:55 This looks like it ought to be a getter.
1285 return false;
1286 }
1287
1288 /**
1269 * Check whether this delta affects the result described by the given 1289 * Check whether this delta affects the result described by the given
1270 * [descriptor] and [target]. The current [value] of the result is provided. 1290 * [descriptor] and [target]. The current [value] of the result is provided.
1271 */ 1291 */
1272 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, 1292 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target,
1273 ResultDescriptor descriptor, Object value) { 1293 ResultDescriptor descriptor, Object value) {
1274 return DeltaResult.INVALIDATE; 1294 return DeltaResult.INVALIDATE;
1275 } 1295 }
1276 } 1296 }
1277 1297
1278 /** 1298 /**
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 void resultAccessed(TargetedResult result) {} 1528 void resultAccessed(TargetedResult result) {}
1509 1529
1510 @override 1530 @override
1511 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { 1531 List<TargetedResult> resultStored(TargetedResult newResult, newValue) {
1512 return TargetedResult.EMPTY_LIST; 1532 return TargetedResult.EMPTY_LIST;
1513 } 1533 }
1514 1534
1515 @override 1535 @override
1516 void targetRemoved(AnalysisTarget target) {} 1536 void targetRemoved(AnalysisTarget target) {}
1517 } 1537 }
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