tlang-interperter-cs/tlanglib/ScopeNode.cs

18 lines
472 B
C#
Raw Normal View History

2023-03-09 19:40:14 +00:00
namespace tlang
{
public class ScopeNode : Node
{
2023-03-09 23:57:16 +00:00
public bool First {get;set;}
2023-03-09 19:40:14 +00:00
public List<Node> Body {get;set;}= new List<Node>();
public override TObject Execute(IScopeEnvironment nodeEnv)
{
2023-03-09 23:57:16 +00:00
var sub = First ? nodeEnv : nodeEnv.SubEnv;
2023-03-09 19:40:14 +00:00
TObject obj=new TNull();
foreach(var item in Body)
{
obj=item.Execute(sub);
}
return obj;
}
}
}