Output: Correctly handle slicing of explicit interface implementations with built-in types
This commit is contained in:
@@ -57,12 +57,10 @@ namespace Il2CppInspector.Reflection
|
|||||||
OperatorMethodNames.ContainsKey(Name)? "operator " + OperatorMethodNames[Name]
|
OperatorMethodNames.ContainsKey(Name)? "operator " + OperatorMethodNames[Name]
|
||||||
|
|
||||||
// Explicit interface implementation
|
// Explicit interface implementation
|
||||||
: (IsVirtual && IsFinal && (Attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot)?
|
: (IsVirtual && IsFinal && (Attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot && Name.IndexOf('.') != -1)?
|
||||||
((Func<string>)(() => {
|
((Func<string>)(() => {
|
||||||
var implementingInterface = DeclaringType.ImplementedInterfaces.FirstOrDefault(i => Name.StartsWith(Regex.Replace(i.FullName, @"`\d", "").Replace('[', '<').Replace(']', '>') + "."));
|
var implementingInterface = DeclaringType.ImplementedInterfaces.FirstOrDefault(i => Name.StartsWith(i.Namespace + "." + i.CSharpName + "."))
|
||||||
// Regular interface implementation
|
?? DeclaringType.ImplementedInterfaces.FirstOrDefault(i => Name.StartsWith(Regex.Replace(i.FullName, @"`\d", "").Replace('[', '<').Replace(']', '>') + "."));
|
||||||
if (implementingInterface == null)
|
|
||||||
return Name;
|
|
||||||
var sliceLength = Regex.Replace(implementingInterface.FullName, @"`\d", "").Length + 1;
|
var sliceLength = Regex.Replace(implementingInterface.FullName, @"`\d", "").Length + 1;
|
||||||
return implementingInterface.CSharpName + "." + Name.Substring(sliceLength);
|
return implementingInterface.CSharpName + "." + Name.Substring(sliceLength);
|
||||||
}))()
|
}))()
|
||||||
@@ -135,7 +133,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
{ IsConstructor: true, IsStatic: true } => "",
|
{ IsConstructor: true, IsStatic: true } => "",
|
||||||
|
|
||||||
// Explicit interface implementations do not have an access level modifier
|
// Explicit interface implementations do not have an access level modifier
|
||||||
{ IsVirtual: true, IsFinal: true, Attributes: var a } when (a & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot => "",
|
{ IsVirtual: true, IsFinal: true, Attributes: var a } when (a & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot && Name.IndexOf('.') != -1 => "",
|
||||||
|
|
||||||
{ IsPrivate: true } => "private ",
|
{ IsPrivate: true } => "private ",
|
||||||
{ IsPublic: true } => "public ",
|
{ IsPublic: true } => "public ",
|
||||||
|
|||||||
Reference in New Issue
Block a user