Skip to content

Commit

Permalink
Merge pull request #280 from ds5678/Feature/RedirectObjectBaseTypeWhe…
Browse files Browse the repository at this point in the history
…nMemberCloning

[Feature]: Redirect System.Object base type when member cloning
  • Loading branch information
Washi1337 committed Mar 30, 2022
2 parents fb599dc + 45e96ce commit 1b8f5f1
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,15 @@ public override IMethodDefOrRef ImportMethod(IMethodDefOrRef method)
? (IMethodDefOrRef) clonedMethod
: base.ImportMethod(method);
}

/// <inheritdoc />
protected override ITypeDefOrRef ImportType(TypeReference type)
{
return type.Namespace == "System"
&& type.Name == nameof(System.Object)
&& (type.Scope?.GetAssembly()?.IsCorLib ?? false)
? _context.Module.CorLibTypeFactory.Object.Type
: base.ImportType(type);
}
}
}
}

0 comments on commit 1b8f5f1

Please sign in to comment.