From 5e7257d7bcea0fc00595fb805b7cc410c39b1397 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 26 Aug 2020 13:11:56 +0200 Subject: [PATCH] Weaver ValidateRemoteCallAndParameters IsStatic check added so we don't need to check in Command/Rpc/TargetRpcProcessors --- .../Mirror/Editor/Weaver/Processors/CommandProcessor.cs | 6 ------ .../Editor/Weaver/Processors/NetworkBehaviourProcessor.cs | 8 +++++++- Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs | 6 ------ .../Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs | 6 ------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs index 0f8107560..53f7683fb 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs @@ -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); } diff --git a/Assets/Mirror/Editor/Weaver/Processors/NetworkBehaviourProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/NetworkBehaviourProcessor.cs index e357cbe78..6f1efad82 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/NetworkBehaviourProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/NetworkBehaviourProcessor.cs @@ -875,8 +875,14 @@ public static void AddInvokeParameters(ICollection 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); } diff --git a/Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs index 29ba07100..08f010205 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs @@ -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); } diff --git a/Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs index 978d699e9..1fdf78f9d 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs @@ -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); }