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

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

Issue 2167773007: Use local variable/function index in its enclosing executable as a part of the identifier. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac7870dab8089665bcc9748817357f533b25e0f0..1194f5f2a5f495c13668ccde24df7b5191cd8bbd 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -1205,19 +1205,13 @@ class _ElementOffsetUpdater extends GeneralizingElementVisitor {
// name offset
int nameOffset = element.nameOffset;
if (nameOffset > updateOffset) {
- // TODO(scheglov) make sure that we don't put local variables
- // and functions into the cache at all.
- 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) {
Expression initializer = element.constantInitializer;
if (initializer != null) {
_shiftTokens(initializer.beginToken);
}
+ _shiftErrors(element.evaluationResult?.errors);
}
}
// code range
@@ -1260,6 +1254,17 @@ class _ElementOffsetUpdater extends GeneralizingElementVisitor {
super.visitElement(element);
}
+ void _shiftErrors(List<AnalysisError> errors) {
+ if (errors != null) {
+ for (AnalysisError error in errors) {
+ int errorOffset = error.offset;
+ if (errorOffset > updateOffset) {
+ error.offset += updateDelta;
+ }
+ }
+ }
+ }
+
void _shiftTokens(Token token) {
while (token != null) {
if (token.offset > updateOffset) {
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698