Skip to content

Commit

Permalink
Small tweaks to the CreateTypedefs pass: (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 authored Dec 22, 2022
1 parent d984c57 commit 384d4ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Il2CppInterop.Generator/Passes/Pass10CreateTypedefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ public static void DoPass(RewriteGlobalContext context)
{
foreach (var assemblyContext in context.Assemblies)
foreach (var type in assemblyContext.OriginalAssembly.MainModule.Types)
if (type.Namespace != "Cpp2ILInjected" && type.Name != "<Module>")
if (!IsCpp2ILInjectedType(type) && type.Name != "<Module>")
ProcessType(type, assemblyContext, null);

static bool IsCpp2ILInjectedType(TypeDefinition type) => type.Namespace?.StartsWith("Cpp2ILInjected", StringComparison.Ordinal) ?? false;
}

private static void ProcessType(TypeDefinition type, AssemblyRewriteContext assemblyContext,
Expand Down Expand Up @@ -47,7 +49,7 @@ private static void ProcessType(TypeDefinition type, AssemblyRewriteContext asse

static string GetNamespace(TypeDefinition type, AssemblyRewriteContext assemblyContext)
{
if (type.Name is "<Module>" or "<PrivateImplementationDetails>" || type.DeclaringType is not null)
if (type.Name is "<Module>" || type.DeclaringType is not null)
return type.Namespace;
else
return type.Namespace.UnSystemify(assemblyContext.GlobalContext.Options);
Expand Down

0 comments on commit 384d4ea

Please sign in to comment.