Fixed issue with no parameter funcs

This commit is contained in:
Deukhoofd 2018-12-06 16:25:06 +01:00
parent 4054f1d383
commit 1caf8320b3
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 8 additions and 5 deletions

View File

@ -125,7 +125,7 @@ namespace Upsilon.BaseTypes
if (t == typeof(ScriptType))
return Type.Unknown;
if (typeof(IEnumerable).IsAssignableFrom(t))
return Type.Table | Type.Function;
return Type.Table;
return Type.UserData;
}

View File

@ -109,13 +109,16 @@ namespace Upsilon.StandardLibraries
{
var genericParameters = type.GetGenericArguments();
var parameters = new List<InternalFunctionVariableSymbol.InternalFunctionParameter>();
for (var i = 0; i < genericParameters.Length - 1; i++)
if (genericParameters.Length > 1)
{
var t = DeriveValidTypes(genericParameters[i]);
parameters.Add(new InternalFunctionVariableSymbol.InternalFunctionParameter(t, false));
for (var i = 0; i < genericParameters.Length - 1; i++)
{
var t = DeriveValidTypes(genericParameters[i]);
parameters.Add(new InternalFunctionVariableSymbol.InternalFunctionParameter(t, false));
}
}
var result = genericParameters[parameters.Count - 1].GetScriptType();
var result = genericParameters[genericParameters.Length - 1].GetScriptType();
return new InternalFunctionVariableSymbol(name, true, result, parameters.ToArray());
}