mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Weaver.CanBeResolved moved to Extensions
This commit is contained in:
parent
3ce7eb9915
commit
8a31f15d64
@ -74,5 +74,32 @@ public static bool IsArrayType(this TypeReference tr)
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -182,33 +182,6 @@ public static void ResetRecursionCount()
|
|||||||
s_RecursionCount = 0;
|
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)
|
public static void DLog(TypeDefinition td, string fmt, params object[] args)
|
||||||
{
|
{
|
||||||
if (!m_DebugFlag)
|
if (!m_DebugFlag)
|
||||||
@ -1429,7 +1402,7 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
|
|||||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||||
foreach (TypeDefinition td in moduleDefinition.Types)
|
foreach (TypeDefinition td in moduleDefinition.Types)
|
||||||
{
|
{
|
||||||
if (td.IsClass && CanBeResolved(td.BaseType))
|
if (td.IsClass && td.BaseType.CanBeResolved())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user