Browse Source

Detect non-virtual calls into the base class.

pull/10/head
Daniel Grunwald 15 years ago
parent
commit
98e7c1c01d
  1. 9
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

9
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -479,9 +479,12 @@ namespace Decompiler
target = new TypeReferenceExpression { Type = AstBuilder.ConvertType(cecilMethod.DeclaringType)}; target = new TypeReferenceExpression { Type = AstBuilder.ConvertType(cecilMethod.DeclaringType)};
} }
// TODO: Constructors are ignored if (target is ThisReferenceExpression && opCode.Code == Code.Call) {
if (cecilMethod.Name == ".ctor") { // a non-virtual call on "this" might be a "base"-call.
return new CommentStatement("Constructor"); if (cecilMethod.DeclaringType != methodDef.DeclaringType) {
// If we're not calling a method in the current class; we must be calling one in the base class.
target = new BaseReferenceExpression();
}
} }
// Resolve the method to figure out whether it is an accessor: // Resolve the method to figure out whether it is an accessor:

Loading…
Cancel
Save