37 lines
777 B
C#
37 lines
777 B
C#
|
namespace tlang
|
||
|
{
|
||
|
public class NotNode : Node
|
||
|
{
|
||
|
public Node Node {get;set;}
|
||
|
|
||
|
public NotNode(Node node)
|
||
|
{
|
||
|
this.Node = node;
|
||
|
}
|
||
|
|
||
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
||
|
{
|
||
|
var l = Node.Execute(nodeEnv);
|
||
|
|
||
|
|
||
|
var dleft = l as TDictionary;
|
||
|
|
||
|
if(dleft != null)
|
||
|
{
|
||
|
if(dleft.MemberExists("not"))
|
||
|
{
|
||
|
var mbm = dleft["not"] as ICallable;
|
||
|
if(mbm != null)
|
||
|
{
|
||
|
return mbm.Call();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
return TObject.Boolean(!l.AsBoolean);
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|