Browse Source

Fix decompilation of abstract events.

pull/100/head
Daniel Grunwald 15 years ago
parent
commit
33625c0cc5
  1. 14
      ICSharpCode.Decompiler/Ast/AstBuilder.cs

14
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -721,8 +721,19 @@ namespace ICSharpCode.Decompiler.Ast
return astProp; return astProp;
} }
CustomEventDeclaration CreateEvent(EventDefinition eventDef) AttributedNode CreateEvent(EventDefinition eventDef)
{ {
if (eventDef.AddMethod != null && eventDef.AddMethod.IsAbstract) {
// An abstract event cannot be custom
EventDeclaration astEvent = new EventDeclaration();
ConvertCustomAttributes(astEvent, eventDef);
astEvent.AddAnnotation(eventDef);
astEvent.Variables.Add(new VariableInitializer(CleanName(eventDef.Name)));
astEvent.ReturnType = ConvertType(eventDef.EventType, eventDef);
if (!eventDef.DeclaringType.IsInterface)
astEvent.Modifiers = ConvertModifiers(eventDef.AddMethod);
return astEvent;
} else {
CustomEventDeclaration astEvent = new CustomEventDeclaration(); CustomEventDeclaration astEvent = new CustomEventDeclaration();
ConvertCustomAttributes(astEvent, eventDef); ConvertCustomAttributes(astEvent, eventDef);
astEvent.AddAnnotation(eventDef); astEvent.AddAnnotation(eventDef);
@ -746,6 +757,7 @@ namespace ICSharpCode.Decompiler.Ast
} }
return astEvent; return astEvent;
} }
}
FieldDeclaration CreateField(FieldDefinition fieldDef) FieldDeclaration CreateField(FieldDefinition fieldDef)
{ {

Loading…
Cancel
Save