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

Unified Diff: pkg/analyzer/lib/src/generated/incremental_resolver.dart

Issue 1696193003: Fix cache corruption in incremental resolver (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: post-review cleanup Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/incremental_resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index f102201d4dfc2e118d94d743eaef2679801eae08..7cc84d30453dd3d725a59b5ebb838a32cf6efb35 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -118,12 +118,14 @@ class DeclarationMatcher extends RecursiveAstVisitor {
_gatherElements(element);
node.accept(this);
} on _DeclarationMismatchException {
+ logger.log("mismatched");
return DeclarationMatchKind.MISMATCH;
} finally {
logger.exit();
}
// no API changes
if (_removedElements.isEmpty && _addedElements.isEmpty) {
+ logger.log("no API changes");
return DeclarationMatchKind.MATCH;
}
// simple API change
@@ -2070,12 +2072,12 @@ class _ElementOffsetUpdater extends GeneralizingElementVisitor {
if (nameOffset > updateOffset) {
// TODO(scheglov) make sure that we don't put local variables
// and functions into the cache at all.
- if (element is LocalVariableElement ||
- element is FunctionElement &&
- element.enclosingElement is ExecutableElement) {
+ try {
+ (element as ElementImpl).nameOffset = nameOffset + updateDelta;
+ } on FrozenHashCodeException {
cache.remove(element);
+ (element as ElementImpl).nameOffset = nameOffset + updateDelta;
}
- (element as ElementImpl).nameOffset = nameOffset + updateDelta;
if (element is ConstVariableElement) {
ConstVariableElement constVariable = element as ConstVariableElement;
Expression initializer = constVariable.constantInitializer;

Powered by Google App Engine
This is Rietveld 408576698