tlang-interperter-cs/tlanglib/ScopeNode.cs

22 lines
516 B
C#
Raw Normal View History

2023-03-10 10:12:36 +00:00
using System.Collections.Generic;
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-06-08 18:14:35 +00:00
TObject obj=TObject.Null;
2023-03-09 19:40:14 +00:00
foreach(var item in Body)
{
obj=item.Execute(sub);
}
return obj;
}
2023-06-08 18:14:35 +00:00
2023-03-09 19:40:14 +00:00
}
}