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

Return() public method

Returns from the current method. A value is popped from the stack and used as the return value.
public Return ( ) : void
return void
        public override void Return()
        {
            // This instruction pops a value from the stack if the method returns a value.
            int popCount = this.dynamicMethod.ReturnType == typeof(void) ? 0 : 1;

            // ret = 2A
            Emit1ByteOpCode(0x2A, popCount, 0);

            if (this.stackIsIndeterminate == false)
            {
                // The instruction might pop a value from the stack.
                if (popCount > 0)
                    PopStackOperands(ToVESType(this.dynamicMethod.ReturnType));
                if (this.stackSize != 0)
                {
#if DEBUG
                    throw new InvalidOperationException(string.Format("The evaluation stack should be empty.  Types still on stack: {0}.", StringHelpers.Join(", ", this.operands)));
#else
                    throw new InvalidOperationException("The evaluation stack should be empty.");
#endif
                }
            }
        }
DynamicILGenerator