Weaver.ResolveProperty moved to Resolvers

This commit is contained in:
vis2k 2019-01-02 13:42:12 +01:00
parent 539d2515b4
commit 52d6792f73
2 changed files with 13 additions and 13 deletions

View File

@ -137,5 +137,17 @@ public static FieldReference ResolveField(TypeReference tr, AssemblyDefinition s
}
return null;
}
public static MethodReference ResolveProperty(TypeReference tr, AssemblyDefinition scriptDef, string name)
{
foreach (PropertyDefinition pd in tr.Resolve().Properties)
{
if (pd.Name == name)
{
return scriptDef.MainModule.ImportReference(pd.GetMethod);
}
}
return null;
}
}
}

View File

@ -1034,18 +1034,6 @@ static bool ProcessNetworkBehaviourType(TypeDefinition td)
return false;
}
public static MethodReference ResolveProperty(TypeReference t, string name)
{
foreach (var fd in t.Resolve().Properties)
{
if (fd.Name == name)
{
return scriptDef.MainModule.ImportReference(fd.GetMethod);
}
}
return null;
}
static void SetupUnityTypes()
{
vector2Type = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Vector2");
@ -1170,7 +1158,7 @@ static void SetupTargetTypes()
MessageBaseType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.MessageBase");
SyncListStructType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.SyncListSTRUCT`1");
NetworkBehaviourDirtyBitsReference = ResolveProperty(NetworkBehaviourType, "syncVarDirtyBits");
NetworkBehaviourDirtyBitsReference = Resolvers.ResolveProperty(NetworkBehaviourType, scriptDef, "syncVarDirtyBits");
ComponentType = m_UnityAssemblyDefinition.MainModule.GetType("UnityEngine.Component");
ClientSceneType = m_UNetAssemblyDefinition.MainModule.GetType("Mirror.ClientScene");