Skip to content

Commit

Permalink
Looser filtering on <Module> type name (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
bookdude13 authored Aug 30, 2023
1 parent 4e8264a commit ef427a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ namespace Cpp2IL.Core.Utils.AsmResolver;

public static class AsmResolverAssemblyPopulator
{
public static bool IsTypeContextModule(TypeAnalysisContext typeCtx)
{
return typeCtx.Name.StartsWith("<Module>") || typeCtx.FullName.StartsWith("<Module>");
}

public static void ConfigureHierarchy(AssemblyAnalysisContext asmCtx)
{
foreach (var typeCtx in asmCtx.Types)
{
if (typeCtx.Name == "<Module>")
if (IsTypeContextModule(typeCtx))
continue;

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

foreach (var type in asmContext.Types)
{
if (type.Name == "<Module>")
if (IsTypeContextModule(type))
continue;

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

foreach (var typeContext in asmContext.Types)
{
if (typeContext.Name == "<Module>")
if (IsTypeContextModule(typeContext))
continue;

var managedType = typeContext.GetExtraData<TypeDefinition>("AsmResolverType") ?? throw new($"AsmResolver type not found in type analysis context for {typeContext.Definition?.FullName}");
Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void FillManagedMethodBodies(AssemblyAnalysisContext asmContext)
{
foreach (var typeContext in asmContext.Types)
{
if (typeContext.Name == "<Module>")
if (AsmResolverAssemblyPopulator.IsTypeContextModule(typeContext))
continue;

#if !DEBUG
Expand Down

0 comments on commit ef427a9

Please sign in to comment.