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.completion.contributor.dart.keyword; | 5 library services.completion.contributor.dart.keyword; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 node.parent.parent is CompilationUnit) { | 184 node.parent.parent is CompilationUnit) { |
185 _addCompilationUnitKeywords(); | 185 _addCompilationUnitKeywords(); |
186 } | 186 } |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 @override | 190 @override |
191 visitIfStatement(IfStatement node) { | 191 visitIfStatement(IfStatement node) { |
192 if (entity == node.thenStatement) { | 192 if (entity == node.thenStatement) { |
193 _addStatementKeywords(node); | 193 _addStatementKeywords(node); |
| 194 } else if (entity == node.condition) { |
| 195 _addExpressionKeywords(node); |
194 } | 196 } |
195 } | 197 } |
196 | 198 |
197 @override | 199 @override |
198 visitImportDirective(ImportDirective node) { | 200 visitImportDirective(ImportDirective node) { |
199 if (entity == node.asKeyword) { | 201 if (entity == node.asKeyword) { |
200 if (node.deferredKeyword == null) { | 202 if (node.deferredKeyword == null) { |
201 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH); | 203 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH); |
202 } | 204 } |
203 } | 205 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return false; | 423 return false; |
422 } | 424 } |
423 AstNode parent = body.parent; | 425 AstNode parent = body.parent; |
424 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { | 426 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { |
425 return true; | 427 return true; |
426 } | 428 } |
427 node = parent; | 429 node = parent; |
428 } | 430 } |
429 } | 431 } |
430 } | 432 } |
OLD | NEW |