public void Visit(ISwitchBlock block, SSTPrintingContext c)
        {
            c.Indentation().Keyword("switch").Space().Text("(");
            block.Reference.Accept(this, c);
            c.Text(")").NewLine().Indentation();
            c.IndentationLevel++;
            c.Text("{");

            foreach (var section in block.Sections)
            {
                c.NewLine().Indentation().Keyword("case").Space();
                section.Label.Accept(this, c);
                c.Text(":").StatementBlock(section.Body, this, false);
            }

            if (block.DefaultSection.Any())
            {
                c.NewLine().Indentation().Keyword("default").Text(":")
                .StatementBlock(block.DefaultSection, this, false);
            }

            c.NewLine();
            c.IndentationLevel--;
            c.Indentation().Text("}");
        }
Beispiel #2
0
 public override IStatement Visit(ISwitchBlock stmt, int context)
 {
     return(new SwitchBlock
     {
         Reference = _ref.Anonymize(stmt.Reference),
         Sections = Anonymize(stmt.Sections),
         DefaultSection = Anonymize(stmt.DefaultSection)
     });
 }
 public override void Visit(ISwitchBlock block, RelativeEditLocation loc)
 {
     loc.Size++;
     Visit(block.DefaultSection, loc);
     foreach (var caseBlock in block.Sections)
     {
         Visit(caseBlock.Body, loc);
     }
 }
Beispiel #4
0
 public virtual void Visit(ISwitchBlock block, TContext context)
 {
     block.Reference.Accept(this, context);
     foreach (var caseBlock in block.Sections)
     {
         caseBlock.Label.Accept(this, context);
         Visit(caseBlock.Body, context);
     }
     Visit(block.DefaultSection, context);
 }
Beispiel #5
0
        public int Visit(ISwitchBlock block, int context)
        {
            var size = 1;

            foreach (var c in block.Sections)
            {
                size += Visit(c.Body, 0);
            }

            size += Visit(block.DefaultSection, 0);

            return(size);
        }
 public override void Visit(ISwitchBlock block, UsageContext context)
 {
     foreach (var caseBlock in block.Sections)
     {
         foreach (var statement in caseBlock.Body)
         {
             statement.Accept(this, context);
         }
     }
     foreach (var statement in block.DefaultSection)
     {
         statement.Accept(this, context);
     }
 }
Beispiel #7
0
 public SwitchBlockCompiler(ISwitchBlock switchBlock, AbstractILCompilerParams @params) : base(@params)
 {
 }