Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/prefixed_element_contributor.dart

Issue 1507633002: extract named constructor suggestions from prefixed element contributor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698