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

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

Issue 1239513005: Switch on null-aware operators by default in analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
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 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return token; 217 return token;
218 } 218 }
219 219
220 /** 220 /**
221 * Scan the token between the [start] (inclusive) and [end] (exclusive) 221 * Scan the token between the [start] (inclusive) and [end] (exclusive)
222 * offsets. 222 * offsets.
223 */ 223 */
224 Token _scanRange(int start, int end) { 224 Token _scanRange(int start, int end) {
225 Scanner scanner = new Scanner( 225 Scanner scanner = new Scanner(
226 source, new CharacterRangeReader(reader, start, end), errorListener); 226 source, new CharacterRangeReader(reader, start, end), errorListener);
227 scanner.enableNullAwareOperators = _options.enableNullAwareOperators;
228 return scanner.tokenize(); 227 return scanner.tokenize();
229 } 228 }
230 229
231 /** 230 /**
232 * Update the offsets of every token from the given [token] to the end of the 231 * Update the offsets of every token from the given [token] to the end of the
233 * stream by adding the given [delta]. 232 * stream by adding the given [delta].
234 */ 233 */
235 void _updateOffsets(Token token, int delta) { 234 void _updateOffsets(Token token, int delta) {
236 while (token.type != TokenType.EOF) { 235 while (token.type != TokenType.EOF) {
237 _tokenMap.put(token, token); 236 _tokenMap.put(token, token);
238 token.offset += delta; 237 token.offset += delta;
239 Token comment = token.precedingComments; 238 Token comment = token.precedingComments;
240 while (comment != null) { 239 while (comment != null) {
241 comment.offset += delta; 240 comment.offset += delta;
242 comment = comment.next; 241 comment = comment.next;
243 } 242 }
244 token = token.next; 243 token = token.next;
245 } 244 }
246 _tokenMap.put(token, token); 245 _tokenMap.put(token, token);
247 token.offset += delta; 246 token.offset += delta;
248 } 247 }
249 } 248 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698