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

26 lines
586 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(new TNumber(1))).Execute(nodeEnv);
Node.SetValue(nodeEnv,newVal);
return obj;
}
}
}