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

26 lines
586 B
C#
Raw Normal View History

2023-03-09 23:57:16 +00:00
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;
}
}
}