Jurassic.Compiler.DynamicILGenerator.StoreVariable C# (CSharp) 메소드

StoreVariable() 공개 메소드

Pops the value from the top of the stack and stores it in the given local variable.
public StoreVariable ( ILLocalVariable variable ) : void
variable ILLocalVariable The variable to store the value.
리턴 void
        public override void StoreVariable(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)
            {
                // stloc.0 = 0A
                // stloc.1 = 0B
                // stloc.2 = 0C
                // stloc.3 = 0D
                Emit1ByteOpCode((byte)(0x0A + variable.Index), 1, 0);
            }
            else if (variable.Index < 256)
            {
                // stloc.s index = 13 <unsigned int8>
                Emit1ByteOpCodeInt8(0x13, 1, 0, variable.Index);
            }
            else if (variable.Index < 65535)
            {
                // stloc index = FE 0E <unsigned int16>
                Emit2ByteOpCodeInt16(0xFE, 0x0E, 1, 0, variable.Index);
            }
            else
                throw new InvalidOperationException("Too many local variables.");

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