fix getting MethodInfo

This commit is contained in:
samuraiGH 2024-06-29 15:49:13 +03:00
parent 5fa4d9fce7
commit 84b0dfe537

View file

@ -11610,14 +11610,9 @@ namespace PascalABCCompiler.NETGenerator
if (is_generic)
{
if (value.ElementType.node_kind == node_kind.compiled)
if (helper.IsConstructedGenericType(elementType))
{
enumer_mi = TypeFactory.IEnumerableGenericType.MakeGenericType(elementType).GetMethod("GetEnumerator");
return_type = enumer_mi.ReturnType;
}
else
{
enumer_mi = TypeBuilder.GetMethod(
enumer_mi = TypeBuilder.GetMethod(
TypeFactory.IEnumerableGenericType.MakeGenericType(elementType),
TypeFactory.IEnumerableGenericType.GetMethod("GetEnumerator")
);
@ -11625,6 +11620,11 @@ namespace PascalABCCompiler.NETGenerator
return_type = enumer_mi.ReturnType
.GetGenericTypeDefinition()
.MakeGenericType(elementType);
}
else
{
enumer_mi = TypeFactory.IEnumerableGenericType.MakeGenericType(elementType).GetMethod("GetEnumerator");
return_type = enumer_mi.ReturnType;
}
}
else