25 lines
598 B
C#
25 lines
598 B
C#
|
namespace tlang
|
||
|
{
|
||
|
internal class MultiplyNode : Node
|
||
|
{
|
||
|
public Node Left {get;set;}
|
||
|
public Node Right {get;set;}
|
||
|
|
||
|
public MultiplyNode(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();
|
||
|
}
|
||
|
}
|
||
|
}
|