| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |