提交 b800aa2b 编写于 作者: C Cyrus Najmabadi

Simplify

上级 b793e4a8
...@@ -316,23 +316,19 @@ private static string GenerateUniqueName(IParameterSymbol parameter, ImmutableAr ...@@ -316,23 +316,19 @@ private static string GenerateUniqueName(IParameterSymbol parameter, ImmutableAr
if (statement != null && if (statement != null &&
fieldOrProperty is TSymbol symbol) fieldOrProperty is TSymbol symbol)
{ {
if (before) var symbolSyntax = symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
if (symbolSyntax.Ancestors().Contains(typeDeclaration))
{ {
var symbolSyntax = symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); if (before)
if (symbolSyntax.Ancestors().Contains(typeDeclaration))
{ {
// Found an existing field/property that corresponds to a preceding parameter. // Found an existing field/property that corresponds to a preceding parameter.
// Place ourselves directly after it. // Place ourselves directly after it.
return new CodeGenerationOptions(afterThisLocation: symbolSyntax.GetLocation()); return new CodeGenerationOptions(afterThisLocation: symbolSyntax.GetLocation());
} }
} else
else
{
// Found an existing field/property that corresponds to a following parameter.
// Place ourselves directly before it.
var symbolSyntax = symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
if (symbolSyntax.Ancestors().Contains(typeDeclaration))
{ {
// Found an existing field/property that corresponds to a following parameter.
// Place ourselves directly before it.
return new CodeGenerationOptions(beforeThisLocation: symbolSyntax.GetLocation()); return new CodeGenerationOptions(beforeThisLocation: symbolSyntax.GetLocation());
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册