From d4b5744894a5de8e488f95aa83b99a2dc19b6204 Mon Sep 17 00:00:00 2001 From: de4dot Date: Fri, 3 Feb 2012 09:42:55 +0100 Subject: [PATCH] Add a paramIndex parameter --- blocks/cflow/MethodCallInliner.cs | 2 +- blocks/cflow/MethodCallInlinerBase.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blocks/cflow/MethodCallInliner.cs b/blocks/cflow/MethodCallInliner.cs index e37b2f69..023c06d0 100644 --- a/blocks/cflow/MethodCallInliner.cs +++ b/blocks/cflow/MethodCallInliner.cs @@ -111,7 +111,7 @@ namespace de4dot.blocks.cflow { } } - protected override bool isCompatibleType(TypeReference origType, TypeReference newType) { + protected override bool isCompatibleType(int paramIndex, TypeReference origType, TypeReference newType) { if (MemberReferenceHelper.compareTypes(origType, newType)) return true; if (newType.IsValueType || origType.IsValueType) diff --git a/blocks/cflow/MethodCallInlinerBase.cs b/blocks/cflow/MethodCallInlinerBase.cs index 7ac0928a..e77bb76e 100644 --- a/blocks/cflow/MethodCallInlinerBase.cs +++ b/blocks/cflow/MethodCallInlinerBase.cs @@ -98,7 +98,7 @@ namespace de4dot.blocks.cflow { if (calledMethod == null) return false; - if (!isCompatibleType(calledMethod.MethodReturnType.ReturnType, methodToInline.MethodReturnType.ReturnType)) + if (!isCompatibleType(-1, calledMethod.MethodReturnType.ReturnType, methodToInline.MethodReturnType.ReturnType)) return false; var methodArgs = DotNetUtils.getArgs(methodToInline); @@ -108,7 +108,7 @@ namespace de4dot.blocks.cflow { for (int i = 0; i < calledMethodArgs.Count; i++) { var calledMethodArg = calledMethodArgs[i]; var methodArg = methodArgs[i]; - if (!isCompatibleType(calledMethodArg, methodArg)) { + if (!isCompatibleType(i, calledMethodArg, methodArg)) { if (i != 0 || !calledMethod.HasImplicitThis) return false; if (!isCompatibleValueThisPtr(calledMethodArg, methodArg)) @@ -131,7 +131,7 @@ namespace de4dot.blocks.cflow { if (ctor == null) return false; - if (!isCompatibleType(ctor.DeclaringType, methodToInline.MethodReturnType.ReturnType)) + if (!isCompatibleType(-1, ctor.DeclaringType, methodToInline.MethodReturnType.ReturnType)) return false; var methodArgs = DotNetUtils.getArgs(methodToInline); @@ -139,7 +139,7 @@ namespace de4dot.blocks.cflow { if (methodArgs.Count + 1 - popLastArgs != calledMethodArgs.Count) return false; for (int i = 1; i < calledMethodArgs.Count; i++) { - if (!isCompatibleType(calledMethodArgs[i], methodArgs[i - 1])) + if (!isCompatibleType(i, calledMethodArgs[i], methodArgs[i - 1])) return false; } @@ -166,7 +166,7 @@ namespace de4dot.blocks.cflow { return false; } - protected virtual bool isCompatibleType(TypeReference origType, TypeReference newType) { + protected virtual bool isCompatibleType(int paramIndex, TypeReference origType, TypeReference newType) { return MemberReferenceHelper.compareTypes(origType, newType); }