Jurassic.Compiler.DynamicILGenerator.LoadVariable C# (CSharp) Method

LoadVariable() public method

Pushes the value of the given variable onto the stack.
public LoadVariable ( ILLocalVariable variable ) : void
variable ILLocalVariable The variable whose value will be pushed.
return void
        public override void LoadVariable(ILLocalVariable variable)
        {
            if (variable as DynamicILLocalVariable == null)
                throw new ArgumentNullException("variable");
            if (((DynamicILLocalVariable)variable).ILGenerator != this)
                throw new ArgumentException("The variable wasn't created by this generator.", "variable");

            if (variable.Index <= 3)
            {
                // ldloc.0 = 06
                // ldloc.1 = 07
                // ldloc.2 = 08
                // ldloc.3 = 09
                Emit1ByteOpCode((byte)(0x06 + variable.Index), 0, 1);
            }
            else if (variable.Index < 256)
            {
                // ldloc.s index = 11 <unsigned int8>
                Emit1ByteOpCodeInt8(0x11, 0, 1, variable.Index);
            }
            else if (variable.Index < 65535)
            {
                // ldloc index = FE 0C <unsigned int16>
                Emit2ByteOpCodeInt16(0xFE, 0x0C, 0, 1, variable.Index);
            }
            else
                throw new InvalidOperationException("Too many local variables.");

            PushStackOperand(ToVESType(variable.Type));
        }
DynamicILGenerator