private static void CallBaseTypeFinalizer(MethodDefinition finalizer, CppCodeWriter writer, IRuntimeMetadataAccess metadataAccess)
{
MethodReference method = null;
TypeDefinition definition;
Unity.IL2CPP.ILPreProcessor.TypeResolver resolver;
for (TypeReference reference2 = finalizer.DeclaringType.BaseType; reference2 != null; reference2 = resolver.Resolve(definition.BaseType))
{
definition = reference2.Resolve();
resolver = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(reference2);
foreach (MethodDefinition definition2 in definition.Methods)
{
if (definition2.IsFinalizerMethod())
{
method = resolver.Resolve(definition2);
break;
}
}
}
if (method != null)
{
List <string> argumentArray = new List <string>(2)
{
Naming.ThisParameterName
};
if (MethodSignatureWriter.NeedsHiddenMethodInfo(method, MethodCallType.Normal, false))
{
argumentArray.Add(metadataAccess.HiddenMethodInfo(method));
}
Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolverForMethodToCall = Unity.IL2CPP.ILPreProcessor.TypeResolver.For(finalizer.DeclaringType);
string block = MethodBodyWriter.GetMethodCallExpression(finalizer, typeResolverForMethodToCall.Resolve(method), method, typeResolverForMethodToCall, MethodCallType.Normal, metadataAccess, new VTableBuilder(), argumentArray, false, null);
writer.WriteStatement(block);
}
}