提交 a53f5049 编写于 作者: R Rik Smeets

Use already existing method to get member type

上级 37c86391
......@@ -177,10 +177,10 @@ private IEnumerable<TypeInferenceInfo> GetTypesSimple(ExpressionSyntax expressio
private IEnumerable<TypeInferenceInfo> 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<TypeInferenceInfo>();
}
......@@ -2186,16 +2186,6 @@ private IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedTypeSymbol
return SpecializedCollections.EmptyEnumerable<TypeInferenceInfo>();
}
private ITypeSymbol GetSymbolReturnType(ISymbol symbol)
{
switch (symbol)
{
case IPropertySymbol property: return property.Type;
case IMethodSymbol method: return method.ReturnType;
default: return null;
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册