tlang-interperter-cs/FunctionCallNode.cs

25 lines
613 B
C#

namespace tlang
{
internal class FunctionCallNode : Node
{
public string Text {get;set;}
public List<Node> Args {get;set;}
public FunctionCallNode(string text, List<Node> args)
{
this.Text = text;
this.Args = args;
}
public override TObject Execute(IScopeEnvironment nodeEnv)
{
var n = nodeEnv[Text] as ICallable;
if(n != null)
{
return n.Call(Args.Select<Node,TObject>(e=>e.Execute(nodeEnv)).ToArray());
}
return new TUninit();
}
}
}