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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 throw new AnalysisException( 3108 throw new AnalysisException(
3109 'Cannot scan scripts with multiple fragments'); 3109 'Cannot scan scripts with multiple fragments');
3110 } 3110 }
3111 ScriptFragment fragment = fragments[0]; 3111 ScriptFragment fragment = fragments[0];
3112 3112
3113 Scanner scanner = new Scanner(source, 3113 Scanner scanner = new Scanner(source,
3114 new SubSequenceReader(fragment.content, fragment.offset), 3114 new SubSequenceReader(fragment.content, fragment.offset),
3115 errorListener); 3115 errorListener);
3116 scanner.setSourceStart(fragment.line, fragment.column); 3116 scanner.setSourceStart(fragment.line, fragment.column);
3117 scanner.preserveComments = context.analysisOptions.preserveComments; 3117 scanner.preserveComments = context.analysisOptions.preserveComments;
3118 scanner.enableNullAwareOperators =
3119 context.analysisOptions.enableNullAwareOperators;
3120 3118
3121 outputs[TOKEN_STREAM] = scanner.tokenize(); 3119 outputs[TOKEN_STREAM] = scanner.tokenize();
3122 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); 3120 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts);
3123 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); 3121 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors);
3124 } else if (target is Source) { 3122 } else if (target is Source) {
3125 String content = getRequiredInput(CONTENT_INPUT_NAME); 3123 String content = getRequiredInput(CONTENT_INPUT_NAME);
3126 3124
3127 Scanner scanner = 3125 Scanner scanner =
3128 new Scanner(source, new CharSequenceReader(content), errorListener); 3126 new Scanner(source, new CharSequenceReader(content), errorListener);
3129 scanner.preserveComments = context.analysisOptions.preserveComments; 3127 scanner.preserveComments = context.analysisOptions.preserveComments;
3130 scanner.enableNullAwareOperators =
3131 context.analysisOptions.enableNullAwareOperators;
3132 3128
3133 outputs[TOKEN_STREAM] = scanner.tokenize(); 3129 outputs[TOKEN_STREAM] = scanner.tokenize();
3134 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); 3130 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts);
3135 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); 3131 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors);
3136 } else { 3132 } else {
3137 throw new AnalysisException( 3133 throw new AnalysisException(
3138 'Cannot scan Dart code from a ${target.runtimeType}'); 3134 'Cannot scan Dart code from a ${target.runtimeType}');
3139 } 3135 }
3140 } 3136 }
3141 3137
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 3402
3407 @override 3403 @override
3408 bool moveNext() { 3404 bool moveNext() {
3409 if (_newSources.isEmpty) { 3405 if (_newSources.isEmpty) {
3410 return false; 3406 return false;
3411 } 3407 }
3412 currentTarget = _newSources.removeLast(); 3408 currentTarget = _newSources.removeLast();
3413 return true; 3409 return true;
3414 } 3410 }
3415 } 3411 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/scanner.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698