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.invocation; | 5 library services.completion.contributor.dart.invocation; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; | 10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 _PrefixedIdentifierSuggestionBuilder(this.request); | 258 _PrefixedIdentifierSuggestionBuilder(this.request); |
259 | 259 |
260 @override | 260 @override |
261 bool computeFast(AstNode node) { | 261 bool computeFast(AstNode node) { |
262 return false; | 262 return false; |
263 } | 263 } |
264 | 264 |
265 @override | 265 @override |
266 Future<bool> computeFull(AstNode node) { | 266 Future<bool> computeFull(AstNode node) { |
267 if (node is ConstructorName) { | |
268 // some PrefixedIdentifier nodes are transformed into | |
269 // ConstructorName nodes during the resolution process. | |
270 return new NamedConstructorSuggestionBuilder(request).computeFull(node); | |
271 } | |
272 if (node is PrefixedIdentifier) { | 267 if (node is PrefixedIdentifier) { |
273 SimpleIdentifier prefix = node.prefix; | 268 SimpleIdentifier prefix = node.prefix; |
274 if (prefix != null) { | 269 if (prefix != null) { |
275 Element element = prefix.bestElement; | 270 Element element = prefix.bestElement; |
276 DartType type = prefix.bestType; | 271 DartType type = prefix.bestType; |
277 if (element is! ClassElement) { | 272 if (element is! ClassElement) { |
278 if (type == null || type.isDynamic) { | 273 if (type == null || type.isDynamic) { |
279 // | 274 // |
280 // Given `g. int y = 0;`, the parser interprets `g` as a prefixed | 275 // Given `g. int y = 0;`, the parser interprets `g` as a prefixed |
281 // identifier with no type. | 276 // identifier with no type. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 356 } |
362 return new Future.value(false); | 357 return new Future.value(false); |
363 } | 358 } |
364 | 359 |
365 @override | 360 @override |
366 Future<bool> visitVariableElement(VariableElement element) { | 361 Future<bool> visitVariableElement(VariableElement element) { |
367 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); | 362 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); |
368 return new Future.value(true); | 363 return new Future.value(true); |
369 } | 364 } |
370 } | 365 } |
OLD | NEW |