Exemplo n.º 1
0
        public void Visit(MultiplyOperator @operator)
        {
            @operator.LeftNode.Accept(this);
            var leftValue = this.Result;

            @operator.RightNode.Accept(this);
            var rightValue = this.Result;

            if (leftValue == null || rightValue == null)
            {
                Result = null;
            }
            else
            {
                try
                {
                    Result = checked (leftValue * rightValue);
                }
                catch
                {
                    ErrorHandler.PrintError(Errors.Overflow);
                    Result = null;
                }
            }
        }
Exemplo n.º 2
0
 public void Visit(MultiplyOperator @operator)
 {
     ParenthesizedExpression.Append("(");
     @operator.LeftNode.Accept(this);
     ParenthesizedExpression.Append("*");
     @operator.RightNode.Accept(this);
     ParenthesizedExpression.Append(")");
 }
Exemplo n.º 3
0
        public void Visit(MultiplyOperator @operator)
        {
            @operator.LeftNode.Accept(this);
            var leftValue = this.Result;

            @operator.RightNode.Accept(this);
            var rightValue = this.Result;

            Result = leftValue * rightValue;
        }
Exemplo n.º 4
0
 public void Visit(MultiplyOperator @operator)
 {
     if (!(@operator.LeftNode is MultiplyOperator || @operator.LeftNode is Operand))
     {
         ParenthesizedExpression.Append("(");
     }
     @operator.LeftNode.Accept(this);
     if (!(@operator.LeftNode is MultiplyOperator || @operator.LeftNode is Operand))
     {
         ParenthesizedExpression.Append(")");
     }
     ParenthesizedExpression.Append("*");
     if (!(@operator.RightNode is MultiplyOperator || @operator.RightNode is Operand))
     {
         ParenthesizedExpression.Append("(");
     }
     @operator.RightNode.Accept(this);
     if (!(@operator.RightNode is MultiplyOperator || @operator.RightNode is Operand))
     {
         ParenthesizedExpression.Append(")");
     }
 }