tlang-interperter-cs/tlanglib/PostfixIncrementVariableNod...

26 lines
589 B
C#

namespace tlang
{
public class PostfixIncrementVariableNode : Node
{
public GetVariableValue Node {get;set;}
public PostfixIncrementVariableNode(GetVariableValue ret)
{
Node = ret;
}
public override TObject Execute(IScopeEnvironment nodeEnv)
{
var obj=Node.Execute(nodeEnv);
var newVal=new AddNode(new ConstNode(obj),new ConstNode(TObject.Number(1))).Execute(nodeEnv);
Node.SetValue(nodeEnv,newVal);
return obj;
}
}
}