mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
Fixed regression for generic handling TypeExtension.FindType
Caused by d2c6c9a948
This commit is contained in:
@@ -95,21 +95,22 @@ public static class TypeExtension
|
|||||||
ReadOnlySpan<char> typeName = ReadTypeName(fullName);
|
ReadOnlySpan<char> typeName = ReadTypeName(fullName);
|
||||||
rest = rest.Slice(typeName.Length);
|
rest = rest.Slice(typeName.Length);
|
||||||
|
|
||||||
Type? baseType = GetType(typeName);
|
if (rest.IsEmpty || (rest[0] != '[' && rest[0] != '`'))
|
||||||
|
|
||||||
if (baseType == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rest.IsEmpty)
|
|
||||||
{
|
{
|
||||||
// Non generic type, easy!
|
// Non generic type, easy!
|
||||||
return baseType;
|
return GetType(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rest[0] == '[')
|
if (rest[0] == '[')
|
||||||
{
|
{
|
||||||
|
Type? baseType = GetType(typeName);
|
||||||
|
|
||||||
|
if (baseType == null)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to find element type {typeName} of array type {fullName}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle array type
|
// Handle array type
|
||||||
int rank = 1;
|
int rank = 1;
|
||||||
bool forceMultiDimensional = false;
|
bool forceMultiDimensional = false;
|
||||||
@@ -154,14 +155,11 @@ public static class TypeExtension
|
|||||||
|
|
||||||
Type? genericType = GetType(typeName);
|
Type? genericType = GetType(typeName);
|
||||||
|
|
||||||
Console.WriteLine($"Generic Type: {genericType}");
|
|
||||||
|
|
||||||
List<Type> arguments = new List<Type>();
|
List<Type> arguments = new List<Type>();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Type? argument = FindType(rest, ref rest);
|
Type? argument = FindType(rest, ref rest);
|
||||||
Console.WriteLine($"Argument: {argument}");
|
|
||||||
|
|
||||||
Debug.Assert(argument != null);
|
Debug.Assert(argument != null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user