private static bool IsReferencedExcept( [NotNull] string name, [NotNull] IStatement statement, [CanBeNull] ICSharpIdentifier exception) { foreach (var identifier in statement.Descendants <ICSharpIdentifier>()) { if (identifier != exception && name == identifier.Name) { return(true); } } return(false); }
private static ICSharpIdentifier FindLastInvocationUse([NotNull] IStatement statement, [NotNull] string name) { ICSharpIdentifier lastInvocationUse = null; foreach (var invocation in statement.Descendants <IInvocationExpression>()) { var currentInvocationTarget = ExtractInvocationTargetName(invocation); if (name == currentInvocationTarget?.Name) { lastInvocationUse = currentInvocationTarget; break; } } return(lastInvocationUse); }