public override void VisitSwitchSection(SwitchSection switchSection)
        {
            if (policy.IndentSwitchBody)
            {
                curIndent.Push(IndentType.Block);
            }

            foreach (CaseLabel label in switchSection.CaseLabels)
            {
                FixStatementIndentation(label.StartLocation);
                label.AcceptVisitor(this);
            }
            if (policy.IndentCaseBody)
            {
                curIndent.Push(IndentType.Block);
            }

            foreach (var stmt in switchSection.Statements)
            {
                if (stmt is BreakStatement && !policy.IndentBreakStatements && policy.IndentCaseBody)
                {
                    curIndent.Pop();
                    FixStatementIndentation(stmt.StartLocation);
                    stmt.AcceptVisitor(this);
                    curIndent.Push(IndentType.Block);
                    continue;
                }
                FixStatementIndentation(stmt.StartLocation);
                stmt.AcceptVisitor(this);
            }
            if (policy.IndentCaseBody)
            {
                curIndent.Pop();
            }

            if (policy.IndentSwitchBody)
            {
                curIndent.Pop();
            }
        }
Ejemplo n.º 2
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            SwitchSection o = other as SwitchSection;

            return(o != null && this.CaseLabels.DoMatch(o.CaseLabels, match) && this.Statements.DoMatch(o.Statements, match));
        }
Ejemplo n.º 3
0
 void IAstVisitor.VisitSwitchSection(SwitchSection switchSection)
 {
     Visit(EnterSwitchSection, LeaveSwitchSection, switchSection);
 }