Esempio n. 1
0
    /// <summary>
    /// </summary>
    /// <param name="context">The context.</param>
    public void Compile(CompilationContext context)
    {
        var elseLabel  = context.ILGenerator.DefineLabel();
        var endIfLabel = context.ILGenerator.DefineLabel();

        Condition.Compile(context);
        context.Emit(OpCodes.Brfalse, elseLabel);

        if (TrueBranch != null)
        {
            TrueBranch.Compile(context);
        }

        if (FalseBranch != null)
        {
            context.Emit(OpCodes.Br, endIfLabel);
        }

        context.ILGenerator.MarkLabel(elseLabel);

        if (FalseBranch != null)
        {
            FalseBranch.Compile(context);
        }

        context.ILGenerator.MarkLabel(endIfLabel);
    }
Esempio n. 2
0
        public void Compile(CompilationContext context)
        {
            Label elseLabel  = context.ilGenerator.DefineLabel();
            Label endIfLabel = context.ilGenerator.DefineLabel();

            condition.Compile(context);
            context.Emit(OpCodes.Brfalse, elseLabel);

            if (trueBranch != null)
            {
                trueBranch.Compile(context);
            }
            if (falseBranch != null)
            {
                context.Emit(OpCodes.Br, endIfLabel);
            }

            context.ilGenerator.MarkLabel(elseLabel);
            if (falseBranch != null)
            {
                falseBranch.Compile(context);
            }
            context.ilGenerator.MarkLabel(endIfLabel);
        }
Esempio n. 3
0
 public void Compile(CompilationContext context)
 {
     _leftValue.Compile(context);
     _rightValue.Compile(context);
     context.Emit(OpCodes.Ceq);
 }