mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:16:51 +00:00
Limit cache invalidation by the updated source bounds.
R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org//1355853005 .
This commit is contained in:
parent
f4baf19a4c
commit
a25cc8129a
|
@ -43,6 +43,12 @@ final String HTML_ERRORS_EXTENSION_POINT_ID = Plugin.join(
|
|||
* The identifier of the extension point that allows plugins to register new
|
||||
* analysis tasks with the analysis engine. The object used as an extension must
|
||||
* be a [TaskDescriptor].
|
||||
*
|
||||
* Contributed tasks should never extract information from Dart elements or AST
|
||||
* (e.g. offsets) of a source and put it into results for targets in other
|
||||
* sources. Dart elements and ASTs are updated during incremental resolution,
|
||||
* and invalidation of results is intentionally limited by the source bounds
|
||||
* for performance reasons.
|
||||
*/
|
||||
final String TASK_EXTENSION_POINT_ID = Plugin.join(
|
||||
EnginePlugin.UNIQUE_IDENTIFIER, EnginePlugin.TASK_EXTENSION_POINT);
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'dart:collection';
|
|||
import 'dart:math' as math;
|
||||
|
||||
import 'package:analyzer/src/context/cache.dart'
|
||||
show CacheEntry, Delta, DeltaResult, TargetedResult;
|
||||
show CacheEntry, Delta, DeltaResult;
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/task/dart.dart';
|
||||
import 'package:analyzer/task/dart.dart';
|
||||
|
@ -857,6 +857,12 @@ class IncrementalBodyDelta extends Delta {
|
|||
@override
|
||||
DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target,
|
||||
ResultDescriptor descriptor) {
|
||||
// A body change delta should never leak outside its source.
|
||||
// It can cause invalidation of results (e.g. hints) in other sources,
|
||||
// but only when a result in the updated source is INVALIDATE_NO_DELTA.
|
||||
if (target.source != source) {
|
||||
return DeltaResult.STOP;
|
||||
}
|
||||
// don't invalidate results of standard Dart tasks
|
||||
bool isByTask(TaskDescriptor taskDescriptor) {
|
||||
return taskDescriptor.results.contains(descriptor);
|
||||
|
|
Loading…
Reference in a new issue