KumiScript/interpreter/expression/ProcedureExpression.cs

42 lines
1 KiB
C#
Raw Permalink Normal View History

2024-01-26 05:37:51 +00:00
namespace KumiScript.Interpreter
{
public class ProcedureExpression : Expression
{
readonly Procedure _proc;
readonly bool _branching;
public ProcedureExpression(Procedure p)
{
_proc = p;
_branching = false;
}
public ProcedureExpression(Procedure p, bool branching)
{
_proc = p;
_branching = branching;
}
public override Expression Eval(Environment env)
{
return this;
}
public override Expression Apply(Expression args, Environment env)
2024-01-26 05:37:51 +00:00
{
return _proc.ApplyWithArgs(args, env);
}
public override string ToString()
{
if (_proc.IsPrimitive())
return string.Format("#Primitive<{0}>", _proc.ToString());
return string.Format("#Procedure<{0}>", _proc.ToString());
}
public override bool IsPrimitive()
2024-01-26 05:37:51 +00:00
{
return _proc.IsPrimitive();
2024-01-26 05:37:51 +00:00
}
}
}