34 lines
759 B
C#
34 lines
759 B
C#
namespace tlang
|
|
{
|
|
internal class SetVariableNode : Node
|
|
{
|
|
public Node Value {get;set;}
|
|
public string Name {get;set;}
|
|
public SetVariableNode(string text,Node v)
|
|
{
|
|
Name=text;
|
|
Value=v;
|
|
}
|
|
|
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
|
{
|
|
var res=Value.Execute(nodeEnv);
|
|
nodeEnv[Name]=res;
|
|
return res;
|
|
}
|
|
}
|
|
public class GetVariableValue : Node
|
|
{
|
|
public string Name {get;set;}
|
|
|
|
public GetVariableValue(string text)
|
|
{
|
|
this.Name = text;
|
|
}
|
|
|
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
|
{
|
|
return nodeEnv[Name];
|
|
}
|
|
}
|
|
} |