Output: Give methods that don't return void "=> default"

This commit is contained in:
Katy Coe
2019-11-16 21:12:02 +01:00
parent 7de9451e7c
commit 0c259836c7

View File

@@ -387,7 +387,11 @@ namespace Il2CppInspector
writer.Append($"\n{prefix}\t\t{constraint}"); writer.Append($"\n{prefix}\t\t{constraint}");
} }
writer.Append((method.IsAbstract? ";" : @" {}") + (!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n"); var methodBody = method.ReturnType switch {
{ FullName: "System.Void" } => @"{}",
_ => "=> default;"
};
writer.Append((method.IsAbstract? ";" : " " + methodBody) + (!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n");
return writer.ToString(); return writer.ToString();
} }