+2004-04-29 Martin Baulig <martin@ximian.com>
+
+ * class.cs (Event.Define): Don't emit the field and don't set
+ RTSpecialName and SpecialName for events on interfaces. Fixes
+ #57703.
+
2004-04-29 Raja R Harinath <rharinath@novell.com>
Refactor Attribute.ApplyAttributes.
is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
name, init, attrs, loc)
{
+ IsInterface = is_iface;
Add = new AddDelegateMethod (this, add);
Remove = new RemoveDelegateMethod (this, remove);
- IsInterface = is_iface;
this.ds = ds;
}
public override bool Define (TypeContainer container)
{
- EventAttributes e_attr = EventAttributes.RTSpecialName | EventAttributes.SpecialName;
+ EventAttributes e_attr;
+ if (IsInterface)
+ e_attr = EventAttributes.None;
+ else
+ e_attr = EventAttributes.RTSpecialName |
+ EventAttributes.SpecialName;
if (!DoDefine (container))
return false;
EventBuilder = new MyEventBuilder (this,
container.TypeBuilder, Name, e_attr, MemberType);
- if (Add.Accessor == null && Remove.Accessor == null) {
+ if (Add.Accessor == null && Remove.Accessor == null &&
+ !IsInterface) {
FieldBuilder = container.TypeBuilder.DefineField (
Name, MemberType,
FieldAttributes.Private | ((ModFlags & Modifiers.STATIC) != 0 ? FieldAttributes.Static : 0));
Attribute.ApplyAttributes (ec, EventBuilder, this, OptAttributes);
}
- Add.Emit (tc);
- Remove.Emit (tc);
+ if (!IsInterface) {
+ Add.Emit (tc);
+ Remove.Emit (tc);
+ }
base.Emit (tc);
}