提交 be73838f 编写于 作者: B BalajiKris

Better name generation while extracting nullables. In ConditionalAccess...

Better name generation while extracting nullables. In ConditionalAccess Expression ?. if we have a member binding expression, we now use that to get a smart name. If nothing else works and if the original definition is a nullable, we give back the default parameter name (v) we use in for built in types. (changeset 1394509)
上级 dd8f041f
......@@ -222,6 +222,14 @@ private static bool CanBindToken(SyntaxToken token)
{
return ((MemberAccessExpressionSyntax)current).Name.Identifier.ValueText.ToCamelCase();
}
else if (current is MemberBindingExpressionSyntax)
{
return ((MemberBindingExpressionSyntax)current).Name.Identifier.ValueText.ToCamelCase();
}
else if (current is ConditionalAccessExpressionSyntax)
{
current = ((ConditionalAccessExpressionSyntax)current).WhenNotNull;
}
else if (current is CastExpressionSyntax)
{
current = ((CastExpressionSyntax)current).Expression;
......
......@@ -559,7 +559,7 @@ private static string GetParameterName(ITypeSymbol type)
return DefaultParameterName;
}
if (type.IsSpecialType())
if (type.IsSpecialType() || type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
{
return DefaultBuiltInParameterName;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册