protected override EvaluationResult EvaluateImpl(SyntaxNode node)
{
var catchClause = (CatchClauseSyntax)node;
var catchesException = catchClause
.DescendantNodesAndSelf()
.OfType<CatchDeclarationSyntax>()
.SelectMany(x => x.DescendantNodes())
.OfType<IdentifierNameSyntax>()
.Any(x => x.Identifier.ValueText == "Exception");
var throwsSomething = catchClause
.DescendantNodes()
.OfType<ThrowStatementSyntax>()
.Any(x => x.Expression != null);
if (catchesException && throwsSomething)
{
var result = new EvaluationResult
{
Snippet = catchClause.ToFullString()
};
return result;
}
return null;
}
}