Exemple #1
0
        public void Generate()
        {
            ILGenerator   gen;
            Label         returnLabel;
            MethodBuilder mb;

            // getter
            mb = (MethodBuilder)propertyInfo.GetGetMethod();
            if (mb != null)
            {
                gen                     = mb.GetILGenerator();
                returnLabel             = gen.DefineLabel();
                get_builder.ReturnLabel = returnLabel;
                get_builder.Generate(gen);
                gen.MarkLabel(returnLabel);
                gen.Emit(OpCodes.Ret);
            }

            // setter
            mb = (MethodBuilder)propertyInfo.GetSetMethod();
            if (mb != null)
            {
                gen                     = mb.GetILGenerator();
                returnLabel             = gen.DefineLabel();
                set_builder.ReturnLabel = returnLabel;
                set_builder.Generate(gen);
                gen.MarkLabel(returnLabel);
                gen.Emit(OpCodes.Ret);
            }
        }
Exemple #2
0
        internal void Generate(ILGenerator gen)
        {
            Label returnLabel = gen.DefineLabel();

            builder.ReturnLabel = returnLabel;
            builder.Generate(gen);
            gen.MarkLabel(returnLabel);
            gen.Emit(OpCodes.Ret);
        }
Exemple #3
0
        public void Generate()
        {
            ILGenerator gen         = methodBase is MethodInfo ? ((MethodBuilder)methodBase).GetILGenerator() : ((ConstructorBuilder)methodBase).GetILGenerator();
            Label       returnLabel = gen.DefineLabel();

            builder.ReturnLabel = returnLabel;
            builder.Generate(gen);
            gen.MarkLabel(returnLabel);
            gen.Emit(OpCodes.Ret);
        }