Output: extern methods should not declare a body (CS0179)
This commit is contained in:
@@ -431,11 +431,21 @@ namespace Il2CppInspector
|
|||||||
writer.Append($"\n{prefix}\t\t{constraint}");
|
writer.Append($"\n{prefix}\t\t{constraint}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var methodBody = method.ReturnType switch {
|
var methodBody = method switch {
|
||||||
{ FullName: "System.Void" } => @"{}",
|
// Abstract method
|
||||||
_ => "=> default;"
|
{ IsAbstract: true } => ";",
|
||||||
|
|
||||||
|
// Extern method
|
||||||
|
{ Attributes: var a } when (a & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl => ";",
|
||||||
|
|
||||||
|
// No return type
|
||||||
|
{ ReturnType: var retType } when retType.FullName == "System.Void" => @" {}",
|
||||||
|
|
||||||
|
// Return type
|
||||||
|
_ => " => default;"
|
||||||
};
|
};
|
||||||
writer.Append((method.IsAbstract? ";" : " " + methodBody) + (!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n");
|
|
||||||
|
writer.Append(methodBody + (!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n");
|
||||||
|
|
||||||
return writer.ToString();
|
return writer.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user