Browse Source

Remove unneccessary loop

pull/903/head
mohe2015 8 years ago
parent
commit
131233627c
  1. 10
      ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs

10
ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs

@ -35,11 +35,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -35,11 +35,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms
{
if (inst.Method.DeclaringTypeDefinition == null) // TODO: investigate why
return;
foreach (IMethod method in inst.Method.DeclaringTypeDefinition.Methods) {
if (method.FullName.Equals(inst.Method.FullName)) {
MethodDefinition methodDef = context.TypeSystem.GetCecil(method) as MethodDefinition;
MethodDefinition methodDef = context.TypeSystem.GetCecil(inst.Method) as MethodDefinition;
if (methodDef != null && methodDef.Body != null) {
if (method.IsCompilerGeneratedOrIsInCompilerGeneratedClass()) {
if (inst.Method.IsCompilerGeneratedOrIsInCompilerGeneratedClass()) {
// partially copied from CSharpDecompiler
var specializingTypeSystem = this.context.TypeSystem.GetSpecializingTypeSystem(this.context.TypeSystem.Compilation.TypeResolveContext);
var ilReader = new ILReader(specializingTypeSystem);
@ -64,7 +62,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -64,7 +62,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (originalArg.OpCode != OpCode.LdLoc ||
originalArg.Children.Count != 0 ||
((LdLoc)originalArg).Variable.Kind != VariableKind.Parameter ||
((LdLoc)originalArg).Variable.Index != i-1) {
((LdLoc)originalArg).Variable.Index != i - 1) {
return;
}
}
@ -94,8 +92,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -94,8 +92,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms
}
}
}
}
}
// Checks if the method is a proxy method by checking if it only contains a call instruction and if it has special compiler attributes.
private class ProxyMethodVisitor : ILVisitor

Loading…
Cancel
Save