EmitRetDefault() public method

public EmitRetDefault ( ) : void
return void
Esempio n. 1
0
        internal override void Emit(CodeGenerator cg)
        {
            // note: ILBuider removes eventual unreachable .ret opcode

            if (_retlbl != null && _rettmp == null)
            {
                cg.Builder.MarkLabel(_retlbl);
            }

            // return <default>;
            cg.EmitRetDefault();
            cg.Builder.AssertStackEmpty();

            // return <rettemp>;
            if (_rettmp != null)
            {
                Debug.Assert(_retlbl != null);
                cg.Builder.MarkLabel(_retlbl);

                // note: _rettmp is always initialized since we branch to _retlbl only after storing to _rettmp

                cg.Builder.EmitLocalLoad(_rettmp);
                cg.Builder.EmitRet(false);
                cg.Builder.AssertStackEmpty();
            }
        }