mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Weaver.ResolveDefaultPublicCtor moved to Resolvers
This commit is contained in:
parent
a33c20c823
commit
ee618ad8f6
@ -84,5 +84,19 @@ public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDef
|
|||||||
{
|
{
|
||||||
return ResolveMethodWithArg(tr, scriptDef, name, argType.FullName);
|
return ResolveMethodWithArg(tr, scriptDef, name, argType.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MethodDefinition ResolveDefaultPublicCtor(TypeReference variable)
|
||||||
|
{
|
||||||
|
foreach (MethodDefinition methodRef in variable.Resolve().Methods)
|
||||||
|
{
|
||||||
|
if (methodRef.Name == ".ctor" &&
|
||||||
|
methodRef.Resolve().IsPublic &&
|
||||||
|
methodRef.Parameters.Count == 0)
|
||||||
|
{
|
||||||
|
return methodRef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -660,7 +660,7 @@ static MethodDefinition GenerateReadFunction(TypeReference variable)
|
|||||||
{
|
{
|
||||||
// classes are created with their constructor
|
// classes are created with their constructor
|
||||||
|
|
||||||
var ctor = ResolveDefaultPublicCtor(variable);
|
MethodDefinition ctor = Resolvers.ResolveDefaultPublicCtor(variable);
|
||||||
if (ctor == null)
|
if (ctor == null)
|
||||||
{
|
{
|
||||||
Log.Error("The class " + variable.Name + " has no default constructor or it's private, aborting.");
|
Log.Error("The class " + variable.Name + " has no default constructor or it's private, aborting.");
|
||||||
@ -1034,20 +1034,6 @@ static bool ProcessNetworkBehaviourType(TypeDefinition td)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MethodDefinition ResolveDefaultPublicCtor(TypeReference variable)
|
|
||||||
{
|
|
||||||
foreach (MethodDefinition methodRef in variable.Resolve().Methods)
|
|
||||||
{
|
|
||||||
if (methodRef.Name == ".ctor" &&
|
|
||||||
methodRef.Resolve().IsPublic &&
|
|
||||||
methodRef.Parameters.Count == 0)
|
|
||||||
{
|
|
||||||
return methodRef;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GenericInstanceMethod ResolveMethodGeneric(TypeReference t, string name, TypeReference genericType)
|
static GenericInstanceMethod ResolveMethodGeneric(TypeReference t, string name, TypeReference genericType)
|
||||||
{
|
{
|
||||||
foreach (var methodRef in t.Resolve().Methods)
|
foreach (var methodRef in t.Resolve().Methods)
|
||||||
|
Loading…
Reference in New Issue
Block a user