提交 eca1ed52 编写于 作者: J JieCarolHu

remove redundant check

上级 87c7a6b5
......@@ -137,12 +137,8 @@ protected override bool TryAnalyzeVariableDeclaration(TypeSyntax typeName, Seman
else if (typeName.Parent is ForEachStatementSyntax foreachStatement &&
IsExpressionSameAfterVarConversion(foreachStatement.Expression, semanticModel, cancellationToken))
{
var foreachStatementInfo = semanticModel.GetForEachStatementInfo(foreachStatement);
if (foreachStatementInfo.ElementConversion.IsIdentityOrImplicitReference())
{
issueSpan = candidateIssueSpan;
return true;
}
issueSpan = candidateIssueSpan;
return true;
}
else if (typeName.Parent is DeclarationExpressionSyntax declarationExpression &&
TryAnalyzeDeclarationExpression(declarationExpression, semanticModel, optionSet, cancellationToken))
......@@ -268,7 +264,7 @@ protected override bool TryAnalyzeVariableDeclaration(TypeSyntax typeName, Seman
// and if we're replacing the declaration with 'var' we'd be changing the semantics by inferring type of
// initializer expression and thereby losing the conversion.
var conversion = semanticModel.GetConversion(expression, cancellationToken);
return conversion.Exists && conversion.IsImplicit && conversion.IsIdentity;
return conversion.IsIdentity;
}
protected override bool ShouldAnalyzeDeclarationExpression(DeclarationExpressionSyntax declaration, SemanticModel semanticModel, CancellationToken cancellationToken)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册