Handle unnamed functions better

This commit is contained in:
2018-12-09 17:49:54 +01:00
parent 5d7f155550
commit 875525b6be
2 changed files with 27 additions and 9 deletions

View File

@@ -53,8 +53,17 @@ namespace Upsilon.BaseTypes.ScriptFunction
object result;
try
{
result = _object.GetType().InvokeMember(_method.Name, BindingFlags.InvokeMethod, UpsilonBinder.Default,
_object, objects.ToArray());
if (_object == null)
{
var array = objects.ToArray();
var methodInfo = _method.GetMethod(ref array);
result = methodInfo.Invoke(null, array);
}
else
{
result = _object.GetType().InvokeMember(_method.Name, BindingFlags.InvokeMethod, UpsilonBinder.Default,
_object, objects.ToArray());
}
}
catch (TargetInvocationException e)
{