//----------------------------------------------------------------------------------------------------------------------------------------------------- internal HappilField DefineField(string name, Type fieldType, bool isStatic) { var field = new HappilField(m_HappilClass, name, fieldType, isStatic); m_HappilClass.AddUndeclaredMember(field); return(field); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- internal HappilEvent(HappilClass happilClass, EventInfo declaration) { m_HappilClass = happilClass; m_Declaration = declaration; m_EventBuilder = happilClass.TypeBuilder.DefineEvent(declaration.Name, declaration.Attributes, declaration.EventHandlerType); using (CreateTypeTemplateScope()) { m_BackingField = new HappilField(happilClass, "m_" + declaration.Name + "EventHandler", typeof(TypeTemplate.TEventHandler)); m_AddMethod = new VoidHappilMethod(happilClass, declaration.GetAddMethod(), ContainedMethodAttributes); m_EventBuilder.SetAddOnMethod(m_AddMethod.MethodBuilder); m_RemoveMethod = new VoidHappilMethod(happilClass, declaration.GetRemoveMethod(), ContainedMethodAttributes); m_EventBuilder.SetRemoveOnMethod(m_RemoveMethod.MethodBuilder); } }