protected virtual IfConditionSyntax ReplaceIfExpressionSyntax(IfConditionSyntax syntax) { var hasChanges = Rewrite(syntax.Keyword, out var keyword); hasChanges |= Rewrite(syntax.ConditionExpression, out var conditionExpression); if (!hasChanges) { return(syntax); } return(new IfConditionSyntax(keyword, conditionExpression)); }
protected virtual SyntaxBase ReplaceIfExpressionSyntax(IfConditionSyntax syntax) { var hasChanges = TryRewriteStrict(syntax.Keyword, out var keyword); hasChanges |= TryRewrite(syntax.ConditionExpression, out var conditionExpression); hasChanges |= TryRewrite(syntax.Body, out var body); if (!hasChanges) { return(syntax); } return(new IfConditionSyntax(keyword, conditionExpression, body)); }
void ISyntaxVisitor.VisitIfConditionSyntax(IfConditionSyntax syntax) => ReplaceCurrent(syntax, ReplaceIfExpressionSyntax);
public virtual void VisitIfConditionSyntax(IfConditionSyntax syntax) { this.Visit(syntax.Keyword); this.Visit(syntax.ConditionExpression); this.Visit(syntax.Body); }