| 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.computer.dart.local; | 5 library services.completion.computer.dart.local; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, Ele
mentKind; | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, Ele
mentKind; |
| 10 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; | 10 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 type = loopVar.type; | 152 type = loopVar.type; |
| 153 } else { | 153 } else { |
| 154 id = node.identifier; | 154 id = node.identifier; |
| 155 type = null; | 155 type = null; |
| 156 } | 156 } |
| 157 _addLocalVarSuggestion(id, type); | 157 _addLocalVarSuggestion(id, type); |
| 158 visitNode(node); | 158 visitNode(node); |
| 159 } | 159 } |
| 160 | 160 |
| 161 @override | 161 @override |
| 162 visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 163 // InvocationComputer adds suggestions for prefixed elements |
| 164 // but this computer adds suggestions for the prefix itself |
| 165 SimpleIdentifier prefix = node.prefix; |
| 166 if (prefix == null || request.offset <= prefix.end) { |
| 167 visitNode(node); |
| 168 } |
| 169 } |
| 170 |
| 171 @override |
| 162 visitForStatement(ForStatement node) { | 172 visitForStatement(ForStatement node) { |
| 163 var varList = node.variables; | 173 var varList = node.variables; |
| 164 if (varList != null) { | 174 if (varList != null) { |
| 165 varList.variables.forEach((VariableDeclaration varDecl) { | 175 varList.variables.forEach((VariableDeclaration varDecl) { |
| 166 _addLocalVarSuggestion(varDecl.name, varList.type); | 176 _addLocalVarSuggestion(varDecl.name, varList.type); |
| 167 }); | 177 }); |
| 168 } | 178 } |
| 169 visitNode(node); | 179 visitNode(node); |
| 170 } | 180 } |
| 171 | 181 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 if (name == null || name.length <= 0) { | 433 if (name == null || name.length <= 0) { |
| 424 return DYNAMIC; | 434 return DYNAMIC; |
| 425 } | 435 } |
| 426 TypeArgumentList typeArgs = type.typeArguments; | 436 TypeArgumentList typeArgs = type.typeArguments; |
| 427 if (typeArgs != null) { | 437 if (typeArgs != null) { |
| 428 //TODO (danrubel) include type arguments | 438 //TODO (danrubel) include type arguments |
| 429 } | 439 } |
| 430 return name; | 440 return name; |
| 431 } | 441 } |
| 432 } | 442 } |
| OLD | NEW |