Exemple #1
0
            public override void Lower(InstructionBuilder builder)
            {
                var table = new JumpTableBuilder()
                {
                    Depth = Depth,
                };
                var index = builder.AddJumpTable(table);

                builder.AddInstruction(new Instruction()
                {
                    Code = InstructionCode.Branch, Payload = index
                });

                builder.BeginBlock();

                for (var i = 0; i < Children.Count; i++)
                {
                    table.AddEntry(Literals[i], builder.Next);
                    Children[i].Lower(builder);
                    builder.AddInstruction(new Instruction()
                    {
                        Code = InstructionCode.Pop,
                    });
                }

                builder.EndBlock();
                table.Exit = builder.Next;
            }