From a53f50495785c8f23ed66b974353f6ed3a1f7735 Mon Sep 17 00:00:00 2001 From: Rik Smeets <30838294+rik-smeets@users.noreply.github.com> Date: Sun, 27 May 2018 10:47:04 +0000 Subject: [PATCH] Use already existing method to get member type --- .../CSharpTypeInferenceService.TypeInferrer.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs index 78e358ff540..9147e12ed7b 100644 --- a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs +++ b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs @@ -177,10 +177,10 @@ private IEnumerable GetTypesSimple(ExpressionSyntax expressio private IEnumerable InferTypeInArrowExpressionClause(ArrowExpressionClauseSyntax arrowClause) { var parentSymbol = SemanticModel.GetDeclaredSymbol(arrowClause.Parent, CancellationToken); - var symbolReturnType = GetSymbolReturnType(parentSymbol); + var parentMemberType = GetMemberType(parentSymbol); - return symbolReturnType != null - ? SpecializedCollections.SingletonEnumerable(new TypeInferenceInfo(symbolReturnType)) + return parentMemberType != null + ? SpecializedCollections.SingletonEnumerable(new TypeInferenceInfo(parentMemberType)) : SpecializedCollections.EmptyEnumerable(); } @@ -2186,16 +2186,6 @@ private IEnumerable GetCollectionElementType(INamedTypeSymbol return SpecializedCollections.EmptyEnumerable(); } - - private ITypeSymbol GetSymbolReturnType(ISymbol symbol) - { - switch (symbol) - { - case IPropertySymbol property: return property.Type; - case IMethodSymbol method: return method.ReturnType; - default: return null; - } - } } } } -- GitLab