Browse Source

Merge pull request #663 from someone-with-default-username/master

Fix #635. Decompile static methods in interfaces.
pull/651/merge
Daniel Grunwald 10 years ago
parent
commit
78e7e9fa71
  1. 8
      ICSharpCode.Decompiler/Ast/AstBuilder.cs

8
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -771,6 +771,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -771,6 +771,7 @@ namespace ICSharpCode.Decompiler.Ast
astMethod.Name = CleanName(methodDef.Name);
astMethod.TypeParameters.AddRange(MakeTypeParameters(methodDef.GenericParameters));
astMethod.Parameters.AddRange(MakeParameters(methodDef));
bool createMethodBody = false;
// constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
if (!methodDef.IsVirtual || (methodDef.IsNewSlot && !methodDef.IsPrivate)) astMethod.Constraints.AddRange(MakeConstraints(methodDef.GenericParameters));
if (!methodDef.DeclaringType.IsInterface) {
@ -781,6 +782,13 @@ namespace ICSharpCode.Decompiler.Ast @@ -781,6 +782,13 @@ namespace ICSharpCode.Decompiler.Ast
if (methodDef.IsVirtual == methodDef.IsNewSlot)
SetNewModifier(astMethod);
}
createMethodBody = true;
} else if (methodDef.IsStatic) {
// decompile static method in interface
astMethod.Modifiers = ConvertModifiers(methodDef);
createMethodBody = true;
}
if (createMethodBody) {
astMethod.Body = CreateMethodBody(methodDef, astMethod.Parameters);
if (context.CurrentMethodIsAsync) {
astMethod.Modifiers |= Modifiers.Async;

Loading…
Cancel
Save