Fix ListUserData erroring on type retrieval
This commit is contained in:
parent
ee36060dd6
commit
ce030c484f
|
@ -20,14 +20,28 @@ namespace Upsilon.BaseTypes.UserData
|
|||
{
|
||||
List = list;
|
||||
var type = list.GetType();
|
||||
System.Type elementType;
|
||||
if (type.IsArray)
|
||||
{
|
||||
TypeName = BoundTypeHandler.GetTypeName(type.GetElementType());
|
||||
elementType = type.GetElementType();
|
||||
TypeName = BoundTypeHandler.GetTypeName(elementType);
|
||||
}
|
||||
else
|
||||
{
|
||||
var generic = type.GetGenericArguments()[0];
|
||||
TypeName = BoundTypeHandler.GetTypeName(generic);
|
||||
elementType = type.GetGenericArguments()[0];
|
||||
TypeName = BoundTypeHandler.GetTypeName(elementType);
|
||||
}
|
||||
|
||||
if (TypeName == null)
|
||||
{
|
||||
Type = new CompositeTypeContainer(new TypeContainer[] {BaseTypes.Type.Number, new UndefinedUserDataTypeContainer(elementType)}
|
||||
.ToImmutableArray());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = new CompositeTypeContainer(new TypeContainer[] {BaseTypes.Type.Number, new TypeContainer(TypeName)}
|
||||
.ToImmutableArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,9 +102,7 @@ namespace Upsilon.BaseTypes.UserData
|
|||
}
|
||||
}
|
||||
|
||||
public override TypeContainer Type =>
|
||||
new CompositeTypeContainer(new TypeContainer[] {BaseTypes.Type.Number, new TypeContainer(TypeName)}
|
||||
.ToImmutableArray());
|
||||
public override TypeContainer Type { get; }
|
||||
public override object ToCSharpObject()
|
||||
{
|
||||
return List;
|
||||
|
|
Loading…
Reference in New Issue