Output: Only create method and constructor bodies if MustCompile is enabled
This commit is contained in:
@@ -476,6 +476,7 @@ namespace Il2CppInspector
|
||||
sb.Append($"{prefix}\t{method.GetModifierString()}{method.DeclaringType.UnmangledBaseName}{method.GetTypeParametersString(scope)}");
|
||||
sb.Append($"({method.GetParametersString(scope, !SuppressMetadata)})");
|
||||
|
||||
if (MustCompile) {
|
||||
// Class constructor
|
||||
if (method.IsAbstract)
|
||||
sb.Append(";");
|
||||
@@ -499,6 +500,8 @@ namespace Il2CppInspector
|
||||
} else
|
||||
sb.Append(" {}");
|
||||
}
|
||||
} else
|
||||
sb.Append(";");
|
||||
|
||||
sb.Append((!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n");
|
||||
}
|
||||
@@ -616,7 +619,7 @@ namespace Il2CppInspector
|
||||
}
|
||||
|
||||
// Body
|
||||
var methodBody = method switch {
|
||||
var methodBody = MustCompile? method switch {
|
||||
// Abstract method
|
||||
{ IsAbstract: true } => ";",
|
||||
|
||||
@@ -637,12 +640,15 @@ namespace Il2CppInspector
|
||||
|
||||
// Regular return type
|
||||
_ => " => default;"
|
||||
};
|
||||
}
|
||||
|
||||
// Only make a method body if we are trying to compile the output
|
||||
: ";";
|
||||
|
||||
writer.Append(methodBody + (!SuppressMetadata && method.VirtualAddress != null ? $" // {method.VirtualAddress.ToAddressString()}" : "") + "\n");
|
||||
|
||||
// Ref return type requires us to invent a field
|
||||
if (method.ReturnType.IsByRef)
|
||||
if (MustCompile && method.ReturnType.IsByRef)
|
||||
writer.Append($"{prefix}\tprivate {method.ReturnType.GetScopedCSharpName(scope)} _refReturnTypeFor{method.CSharpName};\n");
|
||||
|
||||
return writer.ToString();
|
||||
|
||||
Reference in New Issue
Block a user