Weaver ValidateRemoteCallAndParameters IsStatic check added so we don't need to check in Command/Rpc/TargetRpcProcessors

This commit is contained in:
vis2k 2020-08-26 13:11:56 +02:00
parent 2e178b7eaf
commit 5e7257d7bc
4 changed files with 7 additions and 19 deletions

View File

@ -126,12 +126,6 @@ static void AddSenderConnection(MethodDefinition method, ILProcessor worker)
public static bool ValidateCommand(MethodDefinition md)
{
if (md.IsStatic)
{
Weaver.Error($"{md.Name} cannot be static", md);
return false;
}
// validate
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.Command);
}

View File

@ -875,8 +875,14 @@ public static void AddInvokeParameters(ICollection<ParameterDefinition> collecti
}
// check if a Command/TargetRpc/Rpc function & parameters are valid for weaving
public static bool ValidateRemoteCallAndParameters(MethodReference method, RemoteCallType callType)
public static bool ValidateRemoteCallAndParameters(MethodDefinition method, RemoteCallType callType)
{
if (method.IsStatic)
{
Weaver.Error($"{method.Name} must not be static", method);
return false;
}
return ValidateFunction(method) &&
ValidateParameters(method, callType);
}

View File

@ -104,12 +104,6 @@ public static MethodDefinition ProcessRpcCall(TypeDefinition td, MethodDefinitio
public static bool ValidateRpc(MethodDefinition md)
{
if (md.IsStatic)
{
Weaver.Error($"{md.Name} must not be static", md);
return false;
}
// validate
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.ClientRpc);
}

View File

@ -133,12 +133,6 @@ public static MethodDefinition ProcessTargetRpcCall(TypeDefinition td, MethodDef
public static bool ValidateTargetRpc(MethodDefinition md)
{
if (md.IsStatic)
{
Weaver.Error($"{md.Name} must not be static", md);
return false;
}
// validate
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.TargetRpc);
}