Weaver.IsArrayType moved to Extensions

This commit is contained in:
vis2k 2019-01-02 16:15:44 +01:00
parent b96c92c0de
commit a0e763bd38
2 changed files with 10 additions and 10 deletions

View File

@ -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;
}
}
}

View File

@ -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;