31 lines
776 B
C#
31 lines
776 B
C#
namespace tlang
|
|
{
|
|
internal class LogicalAndNode : Node
|
|
{
|
|
public Node Left {get;set;}
|
|
public Node Right {get;set;}
|
|
|
|
public LogicalAndNode(Node left, Node right)
|
|
{
|
|
Left = left;
|
|
Right = right;
|
|
}
|
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
|
{
|
|
var l = Left.Execute(nodeEnv);
|
|
var r = Right.Execute(nodeEnv);
|
|
|
|
var ldict = l as TDictionary;
|
|
|
|
if(ldict != null)
|
|
{
|
|
var lor=ldict["land"] as ICallable;
|
|
if(lor != null)
|
|
{
|
|
return lor.Call(r);
|
|
}
|
|
}
|
|
return new TNumber(l.AsBoolean && r.AsBoolean ? 1 : 0);
|
|
}
|
|
}
|
|
} |