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

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

Issue 1355853005: Limit cache invalidation by the updated source bounds. (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
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 library engine.incremental_resolver; 5 library engine.incremental_resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer/src/context/cache.dart' 10 import 'package:analyzer/src/context/cache.dart'
11 show CacheEntry, Delta, DeltaResult, TargetedResult; 11 show CacheEntry, Delta, DeltaResult;
12 import 'package:analyzer/src/generated/constant.dart'; 12 import 'package:analyzer/src/generated/constant.dart';
13 import 'package:analyzer/src/task/dart.dart'; 13 import 'package:analyzer/src/task/dart.dart';
14 import 'package:analyzer/task/dart.dart'; 14 import 'package:analyzer/task/dart.dart';
15 import 'package:analyzer/task/general.dart' show CONTENT, LINE_INFO; 15 import 'package:analyzer/task/general.dart' show CONTENT, LINE_INFO;
16 import 'package:analyzer/task/model.dart' 16 import 'package:analyzer/task/model.dart'
17 show AnalysisTarget, ResultDescriptor, TargetedResult, TaskDescriptor; 17 show AnalysisTarget, ResultDescriptor, TargetedResult, TaskDescriptor;
18 18
19 import 'ast.dart'; 19 import 'ast.dart';
20 import 'element.dart'; 20 import 'element.dart';
21 import 'engine.dart' 21 import 'engine.dart'
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 */ 850 */
851 final int updateDelta; 851 final int updateDelta;
852 852
853 IncrementalBodyDelta(Source source, this.updateOffset, this.updateEndOld, 853 IncrementalBodyDelta(Source source, this.updateOffset, this.updateEndOld,
854 this.updateEndNew, this.updateDelta) 854 this.updateEndNew, this.updateDelta)
855 : super(source); 855 : super(source);
856 856
857 @override 857 @override
858 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, 858 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target,
859 ResultDescriptor descriptor) { 859 ResultDescriptor descriptor) {
860 // A body change delta should never leak outside its source.
861 // It can cause invalidation of results (e.g. hints) in other sources,
862 // but only when a result in the updated source is INVALIDATE_NO_DELTA.
863 if (target.source != source) {
864 return DeltaResult.STOP;
865 }
860 // don't invalidate results of standard Dart tasks 866 // don't invalidate results of standard Dart tasks
861 bool isByTask(TaskDescriptor taskDescriptor) { 867 bool isByTask(TaskDescriptor taskDescriptor) {
862 return taskDescriptor.results.contains(descriptor); 868 return taskDescriptor.results.contains(descriptor);
863 } 869 }
864 if (descriptor == CONTENT) { 870 if (descriptor == CONTENT) {
865 return DeltaResult.KEEP_CONTINUE; 871 return DeltaResult.KEEP_CONTINUE;
866 } 872 }
867 if (target is LibrarySpecificUnit && target.unit != source) { 873 if (target is LibrarySpecificUnit && target.unit != source) {
868 if (isByTask(GatherUsedLocalElementsTask.DESCRIPTOR) || 874 if (isByTask(GatherUsedLocalElementsTask.DESCRIPTOR) ||
869 isByTask(GatherUsedImportedElementsTask.DESCRIPTOR)) { 875 isByTask(GatherUsedImportedElementsTask.DESCRIPTOR)) {
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 @override 2126 @override
2121 String toString() => name; 2127 String toString() => name;
2122 } 2128 }
2123 2129
2124 class _TokenPair { 2130 class _TokenPair {
2125 final _TokenDifferenceKind kind; 2131 final _TokenDifferenceKind kind;
2126 final Token oldToken; 2132 final Token oldToken;
2127 final Token newToken; 2133 final Token newToken;
2128 _TokenPair(this.kind, this.oldToken, this.newToken); 2134 _TokenPair(this.kind, this.oldToken, this.newToken);
2129 } 2135 }
OLDNEW
« pkg/analyzer/lib/plugin/task.dart ('K') | « pkg/analyzer/lib/plugin/task.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698