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

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/assist_internal.dart

Issue 2050463002: Fix NPE when there is no keyword (issue 26630) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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 services.src.correction.assist; 5 library services.src.correction.assist;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 10 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 _coverageMarker(); 331 _coverageMarker();
332 return; 332 return;
333 } 333 }
334 // type source might be null, if the type is private 334 // type source might be null, if the type is private
335 if (typeSource == null) { 335 if (typeSource == null) {
336 _coverageMarker(); 336 _coverageMarker();
337 return; 337 return;
338 } 338 }
339 // add edit 339 // add edit
340 Token keyword = declarationList.keyword; 340 Token keyword = declarationList.keyword;
341 if (keyword.keyword == Keyword.VAR) { 341 if (keyword?.keyword == Keyword.VAR) {
342 SourceRange range = rangeToken(keyword); 342 SourceRange range = rangeToken(keyword);
343 _addReplaceEdit(range, typeSource); 343 _addReplaceEdit(range, typeSource);
344 } else { 344 } else {
345 _addInsertEdit(variable.offset, '$typeSource '); 345 _addInsertEdit(variable.offset, '$typeSource ');
346 } 346 }
347 // add proposal 347 // add proposal
348 _addAssist(DartAssistKind.ADD_TYPE_ANNOTATION, []); 348 _addAssist(DartAssistKind.ADD_TYPE_ANNOTATION, []);
349 } 349 }
350 350
351 void _addProposal_assignToLocalVariable() { 351 void _addProposal_assignToLocalVariable() {
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 class _SimpleIdentifierRecursiveAstVisitor extends RecursiveAstVisitor { 2139 class _SimpleIdentifierRecursiveAstVisitor extends RecursiveAstVisitor {
2140 final _SimpleIdentifierVisitor visitor; 2140 final _SimpleIdentifierVisitor visitor;
2141 2141
2142 _SimpleIdentifierRecursiveAstVisitor(this.visitor); 2142 _SimpleIdentifierRecursiveAstVisitor(this.visitor);
2143 2143
2144 @override 2144 @override
2145 visitSimpleIdentifier(SimpleIdentifier node) { 2145 visitSimpleIdentifier(SimpleIdentifier node) {
2146 visitor(node); 2146 visitor(node);
2147 } 2147 }
2148 } 2148 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698