Example #1
0
        public ConstructorGen Constructor()
        {
            if (tb.IsInterface)
            {
                throw new InvalidOperationException(Properties.Messages.ErrInterfaceNoCtor);
            }

            ConstructorGen cg = new ConstructorGen(this, mthVis, implFlags);

            ResetAttrs();
            return(cg);
        }
Example #2
0
        internal void Register(ConstructorGen constructor)
        {
            if (constructor.IsStatic)
            {
                return;
            }

            if (constructor.ParameterCount == 0 && tb.IsValueType)
            {
                throw new InvalidOperationException(Properties.Messages.ErrStructNoDefaultCtor);
            }

            constructors.Add(constructor);
        }
Example #3
0
        public ConstructorGen StaticConstructor()
        {
            if (tb.IsInterface)
            {
                throw new InvalidOperationException(Properties.Messages.ErrInterfaceNoCtor);
            }

            if (staticCtor == null)
            {
                staticCtor = new ConstructorGen(this, MethodAttributes.Static, 0).LockSignature();
            }

            return(staticCtor);
        }
Example #4
0
 internal CodeGen(ICodeGenContext context)
 {
     this.context = context;
     this.cg      = context as ConstructorGen;
     il           = context.GetILGenerator();
 }