2023-03-10 10:12:51 +00:00
|
|
|
namespace tlang
|
|
|
|
{
|
|
|
|
internal class LessThanNode : Node
|
|
|
|
{
|
|
|
|
public Node Left {get;set;}
|
|
|
|
public Node Right {get;set;}
|
|
|
|
|
|
|
|
public LessThanNode(Node left, Node right)
|
|
|
|
{
|
|
|
|
this.Left = left;
|
|
|
|
this.Right = right;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
|
|
|
{
|
|
|
|
var l = Left.Execute(nodeEnv);
|
|
|
|
var r = Right.Execute(nodeEnv);
|
|
|
|
var lnum = l as TNumber;
|
|
|
|
var rnum = r as TNumber;
|
|
|
|
var dleft = l as TDictionary;
|
|
|
|
|
|
|
|
if(dleft != null)
|
|
|
|
{
|
|
|
|
if(dleft.MemberExists("lt"))
|
|
|
|
{
|
|
|
|
var mbm = dleft["lt"] as ICallable;
|
|
|
|
if(mbm != null)
|
|
|
|
{
|
|
|
|
return mbm.Call(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(lnum != null && rnum != null)
|
2023-06-08 18:14:35 +00:00
|
|
|
return TObject.Boolean(lnum.Value < rnum.Value);
|
2023-03-10 10:12:51 +00:00
|
|
|
|
2023-06-08 18:14:35 +00:00
|
|
|
return TObject.Null;
|
2023-03-10 10:12:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|