protected virtual void EmitObject() { ObjectType = Generator.DeclareClass(Decorator.Name); ObjectType.BaseTypes.Add(Decorator.BaseClass); //Needed to change the emitted code to be 'public' instead of 'internal' ObjectType.Attributes = MemberAttributes.Public; if (Decorator.EmitAsInterface) { ObjectType.BaseTypes.Add(Decorator.NameInterface); ObjectType.TypeAttributes = TypeAttributes.Public; } else { ObjectType.TypeAttributes = TypeAttributes.Public; } ObjectType.DeclareConstructor(ctor => { ctor.BaseConstructorArgs.Add(Decorator.NameMeta.Expr().Field("Instance")); EmitObjectCtor(ctor); }); EmitObjectMembers(ObjectType, true); }