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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart

Issue 2622303006: Reapply "Add support for generic function type syntax, part 1" (Closed)
Patch Set: Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
index 2c4d91352a1c618a5b62eae33685a24d75f5d3aa..98b7f4b92c6a50c1d3a3fb13e5c243c13e76124b 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
@@ -56,7 +56,10 @@ class VariableNameContributor extends DartCompletionContributor {
strName = _getStringName(node.expression as Identifier);
}
} else if (node is VariableDeclarationList) {
- strName = _getStringName(node.type.name);
+ TypeAnnotation typeAnnotation = node.type;
+ if (typeAnnotation is TypeName) {
+ strName = _getStringName(typeAnnotation.name);
+ }
} else if (node is TopLevelVariableDeclaration) {
// The parser parses 'Foo ' and 'Foo ;' differently, resulting in the
// following.
@@ -64,8 +67,11 @@ class VariableNameContributor extends DartCompletionContributor {
// 'Foo ;': TopLevelVariableDeclaration with type null, and a first
// variable of 'Foo'
VariableDeclarationList varDeclarationList = node.variables;
- if (varDeclarationList.type != null) {
- strName = _getStringName(varDeclarationList.type.name);
+ TypeAnnotation typeAnnotation = varDeclarationList.type;
+ if (typeAnnotation != null) {
+ if (typeAnnotation is TypeName) {
+ strName = _getStringName(typeAnnotation.name);
+ }
} else {
NodeList<VariableDeclaration> varDeclarations =
varDeclarationList.variables;

Powered by Google App Engine
This is Rietveld 408576698