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

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

Issue 717393006: Fix incremental scanner's computation of scanEnd. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_scanner_test.dart » ('j') | 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 engine.incremental_scanner; 5 library engine.incremental_scanner;
6 6
7 import "dart:math" as math; 7 import "dart:math" as math;
8 8
9 import 'error.dart'; 9 import 'error.dart';
10 import 'scanner.dart'; 10 import 'scanner.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 oldRightToken = stream; 129 oldRightToken = stream;
130 } else { 130 } else {
131 oldLast = stream.previous; 131 oldLast = stream.previous;
132 oldRightToken = stream; 132 oldRightToken = stream;
133 } 133 }
134 // 134 //
135 // Compute the range of characters that are known to need to be rescanned. 135 // Compute the range of characters that are known to need to be rescanned.
136 // If the index is within an existing token, then we need to start at the 136 // If the index is within an existing token, then we need to start at the
137 // beginning of the token. 137 // beginning of the token.
138 // 138 //
139 int scanStart = math.max(oldFirst.previous.end, 0); 139 int scanStart = math.max(oldLeftToken.end, 0);
140 int scanEnd = oldLast.end + delta; 140 int scanEnd = oldRightToken.offset + delta;
141 // 141 //
142 // Rescan the characters that need to be rescanned. 142 // Rescan the characters that need to be rescanned.
143 // 143 //
144 Token replacementStart = _scanRange(scanStart, scanEnd); 144 Token replacementStart = _scanRange(scanStart, scanEnd);
145 oldLeftToken.setNext(replacementStart); 145 oldLeftToken.setNext(replacementStart);
146 Token replacementEnd = _findEof(replacementStart).previous; 146 Token replacementEnd = _findEof(replacementStart).previous;
147 replacementEnd.setNext(stream); 147 replacementEnd.setNext(stream);
148 // 148 //
149 // Apply the delta to the tokens after the last new token. 149 // Apply the delta to the tokens after the last new token.
150 // 150 //
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 while (comment != null) { 235 while (comment != null) {
236 comment.offset += delta; 236 comment.offset += delta;
237 comment = comment.next; 237 comment = comment.next;
238 } 238 }
239 token = token.next; 239 token = token.next;
240 } 240 }
241 _tokenMap.put(token, token); 241 _tokenMap.put(token, token);
242 token.offset += delta; 242 token.offset += delta;
243 } 243 }
244 } 244 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698