| 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, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return finished; | 259 return finished; |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 @override | 263 @override |
| 264 visitCombinator(Combinator node) { | 264 visitCombinator(Combinator node) { |
| 265 // Handled by CombinatorComputer | 265 // Handled by CombinatorComputer |
| 266 } | 266 } |
| 267 | 267 |
| 268 @override | 268 @override |
| 269 visitConstructorName(ConstructorName node) { |
| 270 // InvocationComputer adds suggestions for prefixed elements |
| 271 // but this computer adds suggestions for the prefix itself |
| 272 Token period = node.period; |
| 273 if (period == null || request.offset <= period.offset) { |
| 274 visitNode(node); |
| 275 } |
| 276 } |
| 277 |
| 278 @override |
| 269 visitMethodInvocation(MethodInvocation node) { | 279 visitMethodInvocation(MethodInvocation node) { |
| 270 // InvocationComputer adds suggestions for method selector | 280 // InvocationComputer adds suggestions for method selector |
| 271 Token period = node.period; | 281 Token period = node.period; |
| 272 if (period != null && period.offset < request.offset) { | 282 if (period != null && period.offset < request.offset) { |
| 273 ArgumentList argumentList = node.argumentList; | 283 ArgumentList argumentList = node.argumentList; |
| 274 if (argumentList == null || request.offset <= argumentList.offset) { | 284 if (argumentList == null || request.offset <= argumentList.offset) { |
| 275 return; | 285 return; |
| 276 } | 286 } |
| 277 } | 287 } |
| 278 visitNode(node); | 288 visitNode(node); |
| 279 } | 289 } |
| 280 | 290 |
| 281 @override | 291 @override |
| 282 bool visitNamespaceDirective(NamespaceDirective node) { | 292 bool visitNamespaceDirective(NamespaceDirective node) { |
| 283 // No suggestions | 293 // No suggestions |
| 284 return finished; | 294 return finished; |
| 285 } | 295 } |
| 286 | 296 |
| 287 @override | 297 @override |
| 288 visitPrefixedIdentifier(PrefixedIdentifier node) { | 298 visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 289 // InvocationComputer adds suggestions for prefixed elements | 299 // InvocationComputer adds suggestions for prefixed elements |
| 290 // but this computer adds suggestions for the prefix itself | 300 // but this computer adds suggestions for the prefix itself |
| 291 SimpleIdentifier prefix = node.prefix; | 301 Token period = node.period; |
| 292 if (prefix == null || request.offset <= prefix.end) { | 302 if (period == null || request.offset <= period.offset) { |
| 293 visitNode(node); | 303 visitNode(node); |
| 294 } | 304 } |
| 295 } | 305 } |
| 296 | 306 |
| 297 @override | 307 @override |
| 298 visitPropertyAccess(PropertyAccess node) { | 308 visitPropertyAccess(PropertyAccess node) { |
| 299 // InvocationComputer adds suggestions for property access selector | 309 // InvocationComputer adds suggestions for property access selector |
| 300 } | 310 } |
| 301 | 311 |
| 302 @override | 312 @override |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 if (name == null || name.length <= 0) { | 445 if (name == null || name.length <= 0) { |
| 436 return DYNAMIC; | 446 return DYNAMIC; |
| 437 } | 447 } |
| 438 TypeArgumentList typeArgs = type.typeArguments; | 448 TypeArgumentList typeArgs = type.typeArguments; |
| 439 if (typeArgs != null) { | 449 if (typeArgs != null) { |
| 440 //TODO (danrubel) include type arguments | 450 //TODO (danrubel) include type arguments |
| 441 } | 451 } |
| 442 return name; | 452 return name; |
| 443 } | 453 } |
| 444 } | 454 } |
| OLD | NEW |