Weaver.CanBeResolved moved to Extensions

This commit is contained in:
vis2k 2019-01-02 17:08:32 +01:00
parent 3ce7eb9915
commit 8a31f15d64
2 changed files with 28 additions and 28 deletions

View File

@ -74,5 +74,32 @@ public static bool IsArrayType(this TypeReference tr)
return false;
return true;
}
public static bool CanBeResolved(this TypeReference parent)
{
while (parent != null)
{
if (parent.Scope.Name == "Windows")
{
return false;
}
if (parent.Scope.Name == "mscorlib")
{
TypeDefinition resolved = parent.Resolve();
return resolved != null;
}
try
{
parent = parent.Resolve().BaseType;
}
catch
{
return false;
}
}
return true;
}
}
}

View File

@ -182,33 +182,6 @@ public static void ResetRecursionCount()
s_RecursionCount = 0;
}
public static bool CanBeResolved(TypeReference parent)
{
while (parent != null)
{
if (parent.Scope.Name == "Windows")
{
return false;
}
if (parent.Scope.Name == "mscorlib")
{
var resolved = parent.Resolve();
return resolved != null;
}
try
{
parent = parent.Resolve().BaseType;
}
catch
{
return false;
}
}
return true;
}
public static void DLog(TypeDefinition td, string fmt, params object[] args)
{
if (!m_DebugFlag)
@ -1429,7 +1402,7 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
var watch = System.Diagnostics.Stopwatch.StartNew();
foreach (TypeDefinition td in moduleDefinition.Types)
{
if (td.IsClass && CanBeResolved(td.BaseType))
if (td.IsClass && td.BaseType.CanBeResolved())
{
try
{