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

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

Issue 2624283003: Revert "Add support for generic function type syntax, part 1" (TBR) (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/local_reference_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index ae669006a4b522b0cfbac074dfaa806fa8e04ae5..41e50c53e5631d0c8b1f84348e202dd243b26bf4 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -166,7 +166,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
if (optype.includeReturnValueSuggestions &&
(!optype.inStaticMethodBody || fieldDecl.isStatic)) {
bool deprecated = isDeprecated(fieldDecl) || isDeprecated(varDecl);
- TypeAnnotation typeName = fieldDecl.fields.type;
+ TypeName typeName = fieldDecl.fields.type;
_addLocalSuggestion_includeReturnValueSuggestions(
fieldDecl.documentationComment,
varDecl.name,
@@ -182,7 +182,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
void declaredFunction(FunctionDeclaration declaration) {
if (optype.includeReturnValueSuggestions ||
optype.includeVoidReturnSuggestions) {
- TypeAnnotation typeName = declaration.returnType;
+ TypeName typeName = declaration.returnType;
protocol.ElementKind elemKind;
int relevance = DART_RELEVANCE_DEFAULT;
if (declaration.isGetter) {
@@ -233,7 +233,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
}
@override
- void declaredLocalVar(SimpleIdentifier id, TypeAnnotation typeName) {
+ void declaredLocalVar(SimpleIdentifier id, TypeName typeName) {
if (optype.includeReturnValueSuggestions) {
_addLocalSuggestion_includeReturnValueSuggestions(
null, id, typeName, protocol.ElementKind.LOCAL_VARIABLE,
@@ -248,7 +248,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
(!optype.inStaticMethodBody || declaration.isStatic)) {
protocol.ElementKind elemKind;
FormalParameterList param;
- TypeAnnotation typeName = declaration.returnType;
+ TypeName typeName = declaration.returnType;
int relevance = DART_RELEVANCE_DEFAULT;
if (declaration.isGetter) {
elemKind = protocol.ElementKind.GETTER;
@@ -283,7 +283,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
}
@override
- void declaredParam(SimpleIdentifier id, TypeAnnotation typeName) {
+ void declaredParam(SimpleIdentifier id, TypeName typeName) {
if (optype.includeReturnValueSuggestions) {
_addLocalSuggestion_includeReturnValueSuggestions(
null, id, typeName, protocol.ElementKind.PARAMETER,
@@ -306,7 +306,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
}
void _addLocalSuggestion(Comment documentationComment, SimpleIdentifier id,
- TypeAnnotation typeName, protocol.ElementKind elemKind,
+ TypeName typeName, protocol.ElementKind elemKind,
{bool isAbstract: false,
bool isDeprecated: false,
ClassDeclaration classDecl,
@@ -377,7 +377,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
void _addLocalSuggestion_includeReturnValueSuggestions(
Comment documentationComment,
SimpleIdentifier id,
- TypeAnnotation typeName,
+ TypeName typeName,
protocol.ElementKind elemKind,
{bool isAbstract: false,
bool isDeprecated: false,
@@ -417,7 +417,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
void _addLocalSuggestion_includeTypeNameSuggestions(
Comment documentationComment,
SimpleIdentifier id,
- TypeAnnotation typeName,
+ TypeName typeName,
protocol.ElementKind elemKind,
{bool isAbstract: false,
bool isDeprecated: false,
@@ -443,7 +443,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
.map((FormalParameter param) => param.identifier.name)
.toList();
suggestion.parameterTypes = paramList.map((FormalParameter param) {
- TypeAnnotation type = null;
+ TypeName type = null;
if (param is DefaultFormalParameter) {
NormalFormalParameter child = param.parameter;
if (child is SimpleFormalParameter) {
@@ -460,15 +460,11 @@ class _LocalVisitor extends LocalDeclarationVisitor {
if (type == null) {
return 'dynamic';
}
- if (type is TypeName) {
- Identifier typeId = type.name;
- if (typeId == null) {
- return 'dynamic';
- }
- return typeId.name;
+ Identifier typeId = type.name;
+ if (typeId == null) {
+ return 'dynamic';
}
- // TODO(brianwilkerson) Support function types.
- return 'dynamic';
+ return typeId.name;
}).toList();
suggestion.requiredParameterCount = paramList
.where((FormalParameter param) => param is! DefaultFormalParameter)
@@ -477,8 +473,8 @@ class _LocalVisitor extends LocalDeclarationVisitor {
.any((FormalParameter param) => param.kind == ParameterKind.NAMED);
}
- bool _isVoid(TypeAnnotation returnType) {
- if (returnType is TypeName) {
+ bool _isVoid(TypeName returnType) {
+ if (returnType != null) {
Identifier id = returnType.name;
if (id != null && id.name == 'void') {
return true;

Powered by Google App Engine
This is Rietveld 408576698