Refactor TypeInfo names and fix out/in

Replace the deeply nested ternaries in TypeInfo with if-statements for
clarity.
Remove in/out from CSharpName, keeping it only on immediate type params
in CSharpTypeDeclarationName (refactored to a method).
Rearrange name-related properties and methods to group them all together
into a region for easier navigation.
This commit is contained in:
Robert Xiao
2020-04-10 03:05:31 -07:00
committed by Katy
parent 7797ac2506
commit 6ddb502e96
3 changed files with 122 additions and 71 deletions

View File

@@ -549,7 +549,7 @@ namespace Il2CppInspector.Outputs
//sb.Append(del.ReturnType.CustomAttributes.ToString(prefix, "return: ", emitPointer: !SuppressMetadata, mustCompile: MustCompile));
if (del.RequiresUnsafeContext)
sb.Append("unsafe ");
sb.Append($"delegate {del.ReturnType.GetScopedCSharpName(scope)} {type.CSharpTypeDeclarationName}(");
sb.Append($"delegate {del.ReturnType.GetScopedCSharpName(scope)} {type.GetCSharpTypeDeclarationName()}(");
sb.Append(del.GetParametersString(scope, !SuppressMetadata) + ");");
if (!SuppressMetadata)
sb.Append($" // TypeDefIndex: {type.Index}; {del.VirtualAddress.ToAddressString()}");
@@ -566,7 +566,7 @@ namespace Il2CppInspector.Outputs
@base.Insert(0, type.GetEnumUnderlyingType().GetScopedCSharpName(scope));
var baseText = @base.Count > 0 ? " : " + string.Join(", ", @base) : string.Empty;
sb.Append($"{type.CSharpTypeDeclarationName}{baseText}");
sb.Append($"{type.GetCSharpTypeDeclarationName()}{baseText}");
if (!SuppressMetadata)
sb.Append($" // TypeDefIndex: {type.Index}");
sb.Append("\n");