Exemplo n.º 1
0
        public override void RenderIL_Execute(ILCanvas canvas)
        {
            ILCanvasLabel exit_label = canvas.CreateLabel();

            condition.GetILImplicitCast(typeof(bool))
            .RenderIL_Load(canvas);

            if (HasElse())
            {
                ILCanvasLabel false_label = canvas.CreateLabel();

                false_label.Emit_Brfalse();
                if_true_statement.RenderIL_Execute(canvas);
                exit_label.Emit_Br();

                false_label.Emit_Label();
                if_false_statement.RenderIL_Execute(canvas);
            }
            else
            {
                exit_label.Emit_Brfalse();
                if_true_statement.RenderIL_Execute(canvas);
            }

            exit_label.Emit_Label();
        }
Exemplo n.º 2
0
        private ILCanvasLabel FetchLabel(ILCanvas canvas)
        {
            if (label == null)
            {
                label = canvas.CreateLabel();
            }

            return(label);
        }
Exemplo n.º 3
0
        public override void RenderIL_Execute(ILCanvas canvas)
        {
            ILCanvasLabel after_label = canvas.CreateLabel();

            after_label.Emit_Br();

            entry_label.RenderIL_Execute(canvas);
            statement.RenderIL_Execute(canvas);

            after_label.Emit_Label();
        }
Exemplo n.º 4
0
        public override void RenderIL_Load(ILCanvas canvas)
        {
            ILCanvasLabel label = canvas.CreateLabel();

            foreach (ILValue value in values.TruncateFromEnd(1))
            {
                value.RenderIL_Load(canvas);
                canvas.Emit_Dup();

                label.Emit_Brtrue();
                canvas.Emit_Pop();
            }
            values.GetLast().RenderIL_Load(canvas);

            label.Emit_Label();
        }
Exemplo n.º 5
0
        public override void RenderIL_Execute(ILCanvas canvas)
        {
            ILCanvasLabel entry_label = canvas.CreateLabel();
            ILCanvasLabel exit_label  = canvas.CreateLabel();

            entry_label.Emit_Label();

            condition.GetILImplicitCast(typeof(bool))
            .RenderIL_Load(canvas);

            exit_label.Emit_Brfalse();
            while_statement.RenderIL_Execute(canvas);
            entry_label.Emit_Br();

            exit_label.Emit_Label();
        }
Exemplo n.º 6
0
        public override void RenderIL_Load(ILCanvas canvas)
        {
            ILCanvasLabel end_label  = canvas.CreateLabel();
            ILCanvasLabel true_label = canvas.CreateLabel();

            foreach (ILValue value in values)
            {
                value.RenderIL_Load(canvas);
                true_label.Emit_Brtrue();
            }

            canvas.Emit_Ldc_I4(0);
            end_label.Emit_Br();

            true_label.Emit_Label();
            canvas.Emit_Ldc_I4(1);

            end_label.Emit_Label();
        }