Fixing signature import for renamed references
This commit is contained in:
Родитель
eb4d348976
Коммит
1402a8a145
|
@ -239,18 +239,18 @@ namespace Confuser.Renamer.Analyzers {
|
||||||
service.AddReference(def, new TypeRefReference(typeRef, def));
|
service.AddReference(def, new TypeRefReference(typeRef, def));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GenericInstSig SetupSignatureReferences(INameService service, ICollection<ModuleDefMD> modules, ModuleDef module, GenericInstSig typeSig) {
|
private static void SetupSignatureReferences(INameService service, ICollection<ModuleDefMD> modules,
|
||||||
var genericType = SetupSignatureReferences(service, modules, module, typeSig.GenericType);
|
ModuleDef module, GenericInstSig typeSig) {
|
||||||
var genericArguments = typeSig.GenericArguments.Select(a => SetupSignatureReferences(service, modules, module, a)).ToList();
|
SetupSignatureReferences(service, modules, module, typeSig.GenericType);
|
||||||
return new GenericInstSig(genericType, genericArguments);
|
foreach (var genericArgument in typeSig.GenericArguments)
|
||||||
|
SetupSignatureReferences(service, modules, module, genericArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static T SetupSignatureReferences<T>(INameService service, ICollection<ModuleDefMD> modules, ModuleDef module, T typeSig) where T : TypeSig {
|
private static void SetupSignatureReferences(INameService service, ICollection<ModuleDefMD> modules, ModuleDef module, TypeSig typeSig) {
|
||||||
var asTypeRef = typeSig.TryGetTypeRef();
|
var asTypeRef = typeSig.TryGetTypeRef();
|
||||||
if (asTypeRef != null) {
|
if (asTypeRef != null) {
|
||||||
SetupTypeReference(service, modules, module, asTypeRef);
|
SetupTypeReference(service, modules, module, asTypeRef);
|
||||||
}
|
}
|
||||||
return typeSig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetupOverwriteReferences(INameService service, ICollection<ModuleDefMD> modules, VTableSlot slot, ModuleDef module) {
|
private static void SetupOverwriteReferences(INameService service, ICollection<ModuleDefMD> modules, VTableSlot slot, ModuleDef module) {
|
||||||
|
@ -266,10 +266,10 @@ namespace Confuser.Renamer.Analyzers {
|
||||||
|
|
||||||
IMethodDefOrRef target;
|
IMethodDefOrRef target;
|
||||||
if (baseSlot.MethodDefDeclType is GenericInstSig declType) {
|
if (baseSlot.MethodDefDeclType is GenericInstSig declType) {
|
||||||
var signature = SetupSignatureReferences(service, modules, module, declType);
|
MemberRef targetRef = new MemberRefUser(module, baseMethodDef.Name, baseMethodDef.MethodSig, declType.ToTypeDefOrRef());
|
||||||
MemberRef targetRef = new MemberRefUser(module, baseMethodDef.Name, baseMethodDef.MethodSig, signature.ToTypeDefOrRef());
|
|
||||||
targetRef = importer.Import(targetRef);
|
targetRef = importer.Import(targetRef);
|
||||||
service.AddReference(baseMethodDef, new MemberRefReference(targetRef, baseMethodDef));
|
service.AddReference(baseMethodDef, new MemberRefReference(targetRef, baseMethodDef));
|
||||||
|
SetupSignatureReferences(service, modules, module, targetRef.DeclaringType.ToTypeSig() as GenericInstSig);
|
||||||
|
|
||||||
target = targetRef;
|
target = targetRef;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче