tlang-interperter-cs/PostfixDecrementVariableNod...

26 lines
603 B
C#

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