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

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

Issue 1768613002: Update codeOffset/codeLength during incremental resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Extract comparing values. Created 4 years, 9 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 | « pkg/analyzer/lib/src/generated/incremental_resolution_validator.dart ('k') | no next file » | 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) 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 analyzer.src.generated.incremental_resolver; 5 library analyzer.src.generated.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/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 (element as ElementImpl).nameOffset = nameOffset + updateDelta; 2080 (element as ElementImpl).nameOffset = nameOffset + updateDelta;
2081 } 2081 }
2082 if (element is ConstVariableElement) { 2082 if (element is ConstVariableElement) {
2083 ConstVariableElement constVariable = element as ConstVariableElement; 2083 ConstVariableElement constVariable = element as ConstVariableElement;
2084 Expression initializer = constVariable.constantInitializer; 2084 Expression initializer = constVariable.constantInitializer;
2085 if (initializer != null) { 2085 if (initializer != null) {
2086 _shiftTokens(initializer.beginToken); 2086 _shiftTokens(initializer.beginToken);
2087 } 2087 }
2088 } 2088 }
2089 } 2089 }
2090 // code range
2091 if (element is ElementImpl) {
2092 int oldOffset = element.codeOffset;
2093 int oldLength = element.codeLength;
2094 if (oldOffset != null) {
2095 int newOffset = oldOffset;
2096 int newLength = oldLength;
2097 newOffset += oldOffset > updateOffset ? updateDelta : 0;
2098 if (oldOffset <= updateOffset && updateOffset < oldOffset + oldLength) {
2099 newLength += updateDelta;
2100 }
2101 if (newOffset != oldOffset || newLength != oldLength) {
2102 element.setCodeRange(newOffset, newLength);
2103 }
2104 }
2105 }
2090 // visible range 2106 // visible range
2091 if (element is LocalElement) { 2107 if (element is LocalElement) {
2092 SourceRange visibleRange = element.visibleRange; 2108 SourceRange visibleRange = element.visibleRange;
2093 if (visibleRange != null) { 2109 if (visibleRange != null) {
2094 int oldOffset = visibleRange.offset; 2110 int oldOffset = visibleRange.offset;
2095 int oldLength = visibleRange.length; 2111 int oldLength = visibleRange.length;
2096 int newOffset = oldOffset; 2112 int newOffset = oldOffset;
2097 int newLength = oldLength; 2113 int newLength = oldLength;
2098 newOffset += oldOffset > updateOffset ? updateDelta : 0; 2114 newOffset += oldOffset > updateOffset ? updateDelta : 0;
2099 newLength += visibleRange.contains(updateOffset) ? updateDelta : 0; 2115 newLength += visibleRange.contains(updateOffset) ? updateDelta : 0;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 @override 2218 @override
2203 String toString() => name; 2219 String toString() => name;
2204 } 2220 }
2205 2221
2206 class _TokenPair { 2222 class _TokenPair {
2207 final _TokenDifferenceKind kind; 2223 final _TokenDifferenceKind kind;
2208 final Token oldToken; 2224 final Token oldToken;
2209 final Token newToken; 2225 final Token newToken;
2210 _TokenPair(this.kind, this.oldToken, this.newToken); 2226 _TokenPair(this.kind, this.oldToken, this.newToken);
2211 } 2227 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolution_validator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698