Exemplo n.º 1
0
        public Expression Visit(NumBinaryOp op)
        {
            var left  = (NumExpression)op.Left.Accept(this);
            var right = (NumExpression)op.Right.Accept(this);

            return(new NumBinaryOp(op.Operation, left, right));
        }
        public SortedSet <string> Visit(NumBinaryOp op)
        {
            var vars = Run(op.Left);

            vars.UnionWith(Run(op.Right));
            return(vars);
        }
Exemplo n.º 3
0
        public async Task <Value> Visit(NumBinaryOp op)
        {
            Value[] results = await Task.WhenAll <Value>(op.Left.Accept(this), op.Right.Accept(this));

            switch (op.Operation)
            {
            case NumBinOps.Add:
                return((results[0] as NumValue) + (results[1] as NumValue));

            case NumBinOps.Mul:
                return((results[0] as NumValue) * (results[1] as NumValue));

            default:
                throw new ArgumentException();
            }
            throw new NotImplementedException();
        }
Exemplo n.º 4
0
 public T Visit(NumBinaryOp op)
 {
     op.Left.Accept(this);
     op.Right.Accept(this);
     return(default(T));
 }