Skip to content

Commit ef427a9

Browse files
authored
Looser filtering on <Module> type name (#233)
1 parent 4e8264a commit ef427a9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ namespace Cpp2IL.Core.Utils.AsmResolver;
1616

1717
public static class AsmResolverAssemblyPopulator
1818
{
19+
public static bool IsTypeContextModule(TypeAnalysisContext typeCtx)
20+
{
21+
return typeCtx.Name.StartsWith("<Module>") || typeCtx.FullName.StartsWith("<Module>");
22+
}
23+
1924
public static void ConfigureHierarchy(AssemblyAnalysisContext asmCtx)
2025
{
2126
foreach (var typeCtx in asmCtx.Types)
2227
{
23-
if (typeCtx.Name == "<Module>")
28+
if (IsTypeContextModule(typeCtx))
2429
continue;
2530

2631
var il2CppTypeDef = typeCtx.Definition;
@@ -242,7 +247,7 @@ public static void PopulateCustomAttributes(AssemblyAnalysisContext asmContext)
242247

243248
foreach (var type in asmContext.Types)
244249
{
245-
if (type.Name == "<Module>")
250+
if (IsTypeContextModule(type))
246251
continue;
247252

248253
CopyCustomAttributes(type, type.GetExtraData<TypeDefinition>("AsmResolverType")!.CustomAttributes);
@@ -282,7 +287,7 @@ public static void CopyDataFromIl2CppToManaged(AssemblyAnalysisContext asmContex
282287

283288
foreach (var typeContext in asmContext.Types)
284289
{
285-
if (typeContext.Name == "<Module>")
290+
if (IsTypeContextModule(typeContext))
286291
continue;
287292

288293
var managedType = typeContext.GetExtraData<TypeDefinition>("AsmResolverType") ?? throw new($"AsmResolver type not found in type analysis context for {typeContext.Definition?.FullName}");

Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void FillManagedMethodBodies(AssemblyAnalysisContext asmContext)
1414
{
1515
foreach (var typeContext in asmContext.Types)
1616
{
17-
if (typeContext.Name == "<Module>")
17+
if (AsmResolverAssemblyPopulator.IsTypeContextModule(typeContext))
1818
continue;
1919

2020
#if !DEBUG

0 commit comments

Comments
 (0)