tlang-interperter-cs/tlanglib/FunctionCallNode.cs

31 lines
688 B
C#
Raw Permalink Normal View History

2023-03-10 10:12:36 +00:00
using System.Collections.Generic;
2023-06-08 18:14:35 +00:00
using System.IO;
2023-03-10 10:12:36 +00:00
using System.Linq;
2023-03-09 19:40:14 +00:00
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());
}
2023-06-08 18:14:35 +00:00
return TObject.Uninit;
2023-03-09 19:40:14 +00:00
}
2023-06-08 18:14:35 +00:00
2023-03-09 19:40:14 +00:00
}
2023-06-08 18:14:35 +00:00
}