28 lines
667 B
C#
28 lines
667 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
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();
|
|
}
|
|
}
|
|
} |