private VMEntryInfo TryExtractVMEntryInfoFromType(DevirtualisationContext context, TypeDefinition type) { var info = new VMEntryInfo { VMEntryType = type }; foreach (var method in type.Methods) { switch (method.Signature.Parameters.Count) { case 3: if (HasParameterTypes(method, Run1ExpectedTypes)) { info.RunMethod1 = method; } break; case 4: if (HasParameterTypes(method, Run2ExpectedTypes)) { info.RunMethod2 = method; } break; } } if (info.RunMethod1 == null || info.RunMethod2 == null) { return(null); } return(info); }
private VMEntryInfo TryExtractVMEntryInfoFromType(DevirtualisationContext context, TypeDefinition type) { var info = new VMEntryInfo { VMEntryType = type }; foreach (var method in type.Methods) { int count = method.Signature.ParameterTypes.Count; if (count == context.Options.Run1ExpectedTypes.Count) { if (HasParameterTypes(method, context.Options.Run1ExpectedTypes)) { info.RunMethod1 = method; } } else if (count == context.Options.Run2ExpectedTypes.Count) { if (HasParameterTypes(method, context.Options.Run2ExpectedTypes)) { info.RunMethod2 = method; } } } if (info.RunMethod1 == null || info.RunMethod2 == null) { return(null); } return(info); }
private VMEntryInfo TryExtractVMEntryInfoFromType(DevirtualisationContext context, TypeDefinition type) { var info = new VMEntryInfo { VMEntryType = type }; foreach (var method in type.Methods) { var parameters = method.Signature.Parameters; switch (parameters.Count) { case 3: { if (parameters[0].ParameterType.IsTypeOf("System", "RuntimeTypeHandle") && parameters[1].ParameterType.IsTypeOf("System", "UInt32") && parameters[2].ParameterType is SzArrayTypeSignature arrayType && arrayType.BaseType.IsTypeOf("System", "Object")) { info.RunMethod1 = method; } break; } case 4: { if (parameters[0].ParameterType.IsTypeOf("System", "RuntimeTypeHandle") && parameters[1].ParameterType.IsTypeOf("System", "UInt32") && parameters[2].ParameterType is SzArrayTypeSignature arrayType && arrayType.BaseType is PointerTypeSignature pointerType1 && pointerType1.BaseType.IsTypeOf("System", "Void") && parameters[3].ParameterType is PointerTypeSignature pointerType2 && pointerType2.BaseType.IsTypeOf("System", "Void")) { info.RunMethod2 = method; } break; } } } if (info.RunMethod1 == null || info.RunMethod2 == null) { return(null); } return(info); }