修复 DOTSCompilerGenerated和BurstCompile判定没有用于method的bug

before-split
walon 2025-05-27 22:50:05 +08:00
parent 94b9b7ee2f
commit 468ea6a343
2 changed files with 12 additions and 3 deletions

View File

@ -142,7 +142,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{
return true;
}
if (typeDef.CustomAttributes.Find("Unity.Jobs.DOTSCompilerGeneratedAttribute") != null)
if (MetaUtil.HasDOTSCompilerGeneratedAttribute(typeDef))
{
return true;
}
@ -221,9 +221,9 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{
return false;
}
if (MetaUtil.HasBurstCompileAttribute(methodDef))
if (MetaUtil.HasBurstCompileAttribute(methodDef) || MetaUtil.HasDOTSCompilerGeneratedAttribute(methodDef))
{
return true;
return false;
}
return true;
}
@ -239,6 +239,10 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{
return false;
}
if (MetaUtil.HasBurstCompileAttribute(fieldDef) || MetaUtil.HasDOTSCompilerGeneratedAttribute(fieldDef))
{
return false;
}
return true;
}
}

View File

@ -989,5 +989,10 @@ namespace Obfuz.Utils
{
return obj.CustomAttributes.Find("Unity.Burst.BurstCompileAttribute") != null;
}
public static bool HasDOTSCompilerGeneratedAttribute(IHasCustomAttribute obj)
{
return obj.CustomAttributes.Find("Unity.Jobs.DOTSCompilerGeneratedAttribute") != null;
}
}
}