S IAstVisitor <T, S> .VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, T data) { var handler = ArrayInitializerExpressionVisited; if (handler != null) { handler(arrayInitializerExpression, data); } return(VisitChildren(arrayInitializerExpression, data)); }
void IAstVisitor.VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression) { Visit(EnterArrayInitializerExpression, LeaveArrayInitializerExpression, arrayInitializerExpression); }
public override void VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression) { if (DoWrap(policy.ArrayInitializerWrapping, arrayInitializerExpression.RBraceToken, arrayInitializerExpression.Elements.Count)) { FixOpenBrace(policy.ArrayInitializerBraceStyle, arrayInitializerExpression.LBraceToken); curIndent.Push(IndentType.Block); foreach (var init in arrayInitializerExpression.Elements) { FixStatementIndentation(init.StartLocation); init.AcceptVisitor(this); } curIndent.Pop(); FixClosingBrace(policy.ArrayInitializerBraceStyle, arrayInitializerExpression.RBraceToken); } else if (policy.ArrayInitializerWrapping == Wrapping.DoNotWrap) { ForceSpacesBeforeRemoveNewLines(arrayInitializerExpression.LBraceToken); ForceSpacesBeforeRemoveNewLines(arrayInitializerExpression.RBraceToken); foreach (var init in arrayInitializerExpression.Elements) { ForceSpacesBeforeRemoveNewLines(init); init.AcceptVisitor(this); } } else { var lBrace = arrayInitializerExpression.LBraceToken; var rBrace = arrayInitializerExpression.RBraceToken; foreach (var child in arrayInitializerExpression.Children) { if (child.Role == Roles.LBrace) { if (lBrace.StartLocation.Line == rBrace.StartLocation.Line && policy.AllowOneLinedArrayInitialziers) { ForceSpaceBefore(child, true); ForceSpacesAfter(child, true); } else { FixOpenBrace(policy.ArrayInitializerBraceStyle, child); } curIndent.Push(IndentType.Block); continue; } if (child.Role == Roles.RBrace) { curIndent.Pop(); if (lBrace.StartLocation.Line == rBrace.StartLocation.Line && policy.AllowOneLinedArrayInitialziers) { ForceSpaceBefore(child, true); } else { FixClosingBrace(policy.ArrayInitializerBraceStyle, child); } continue; } if (child.Role == Roles.Expression) { if (child.PrevSibling.Role == Roles.NewLine) { FixIndentation(child); } if (child.PrevSibling.Role == Roles.Comma) { ForceSpaceBefore(child, true); } if (child.NextSibling.Role == Roles.Comma) { ForceSpacesAfter(child, false); } continue; } child.AcceptVisitor(this); } } }
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ArrayInitializerExpression o = other as ArrayInitializerExpression; return(o != null && this.Elements.DoMatch(o.Elements, match)); }