25 lines
594 B
C#
25 lines
594 B
C#
namespace tlang
|
|
{
|
|
internal class DivideNode : Node
|
|
{
|
|
public Node Left {get;set;}
|
|
public Node Right {get;set;}
|
|
|
|
public DivideNode(Node left, Node right)
|
|
{
|
|
this.Left = left;
|
|
this.Right = right;
|
|
}
|
|
|
|
public override TObject Execute(IScopeEnvironment nodeEnv)
|
|
{
|
|
var l = Left.Execute(nodeEnv) as TNumber;
|
|
var r = Right.Execute(nodeEnv) as TNumber;
|
|
|
|
if(l != null && r != null)
|
|
return new TNumber(l.Value / r.Value);
|
|
|
|
return new TNull();
|
|
}
|
|
}
|
|
} |