Support for generic Actions
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Upsilon.Evaluator;
|
||||
|
||||
namespace Upsilon.BaseTypes.ScriptFunction
|
||||
{
|
||||
public class ScriptGenericFunction : ScriptFunction
|
||||
{
|
||||
public ScriptGenericFunction(Func<object, IEnumerable<object>> function)
|
||||
{
|
||||
Function = function;
|
||||
}
|
||||
|
||||
public ScriptGenericFunction(object o)
|
||||
{
|
||||
var type = o.GetType();
|
||||
var generics = type.GetGenericArguments();
|
||||
Function.GetMethodInfo();
|
||||
}
|
||||
|
||||
public Func<object, IEnumerable<object>> Function { get; }
|
||||
|
||||
public override ScriptType Run(Diagnostics diagnostics, ScriptType[] variables, Script script,
|
||||
EvaluationScope scope)
|
||||
{
|
||||
return Function.Invoke(variables.Select(x => x.ToCSharpObject())).ToScriptType();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user