示例#1
0
        S IAstVisitor <T, S> .VisitSwitchSection(SwitchSection switchSection, T data)
        {
            var handler = SwitchSectionVisited;

            if (handler != null)
            {
                handler(switchSection, data);
            }
            return(VisitChildren(switchSection, data));
        }
示例#2
0
        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();
            }
        }
示例#3
0
 void IAstVisitor.VisitSwitchSection(SwitchSection switchSection)
 {
     Visit(EnterSwitchSection, LeaveSwitchSection, switchSection);
 }
示例#4
0
 public virtual S VisitSwitchSection(SwitchSection switchSection, T data)
 {
     return(VisitChildren(switchSection, data));
 }
        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));
        }
 public virtual S VisitSwitchSection(SwitchSection switchSection, T data)
 {
     throw new NotImplementedException();
 }