From a0e763bd38e8648d739b2900f10b3aa09fc53703 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 2 Jan 2019 16:15:44 +0100 Subject: [PATCH] Weaver.IsArrayType moved to Extensions --- Mirror/Weaver/Extensions.cs | 8 ++++++++ Mirror/Weaver/Weaver.cs | 12 ++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mirror/Weaver/Extensions.cs b/Mirror/Weaver/Extensions.cs index 49f62b1a7..970128fbc 100644 --- a/Mirror/Weaver/Extensions.cs +++ b/Mirror/Weaver/Extensions.cs @@ -66,5 +66,13 @@ public static bool ImplementsInterface(this TypeDefinition td, TypeReference bas return false; } + + public static bool IsArrayType(this TypeReference tr) + { + if ((tr.IsArray && ((ArrayType)tr).ElementType.IsArray) || // jagged array + (tr.IsArray && ((ArrayType)tr).Rank > 1)) // multidimensional array + return false; + return true; + } } } \ No newline at end of file diff --git a/Mirror/Weaver/Weaver.cs b/Mirror/Weaver/Weaver.cs index 1f45495b6..e030708a0 100644 --- a/Mirror/Weaver/Weaver.cs +++ b/Mirror/Weaver/Weaver.cs @@ -209,14 +209,6 @@ public static bool CanBeResolved(TypeReference parent) return true; } - public static bool IsArrayType(TypeReference variable) - { - if ((variable.IsArray && ((ArrayType)variable).ElementType.IsArray) || // jagged array - (variable.IsArray && ((ArrayType)variable).Rank > 1)) // multidimensional array - return false; - return true; - } - public static void DLog(TypeDefinition td, string fmt, params object[] args) { if (!m_DebugFlag) @@ -369,7 +361,7 @@ static public void RegisterReadFunc(string name, MethodDefinition newReaderFunc) static MethodDefinition GenerateArrayReadFunc(TypeReference variable, MethodReference elementReadFunc) { - if (!IsArrayType(variable)) + if (!variable.IsArrayType()) { Log.Error(variable.FullName + " is an unsupported array type. Jagged and multidimensional arrays are not supported"); return null; @@ -452,7 +444,7 @@ static MethodDefinition GenerateArrayReadFunc(TypeReference variable, MethodRefe static MethodDefinition GenerateArrayWriteFunc(TypeReference variable, MethodReference elementWriteFunc) { - if (!IsArrayType(variable)) + if (!variable.IsArrayType()) { Log.Error(variable.FullName + " is an unsupported array type. Jagged and multidimensional arrays are not supported"); return null;