public void Visit(ArithmeticExpression operand) { operand.Left().Accept(this); var left = _value; operand.Right().Accept(this); var right = _value; switch (operand.Op().Id()) { case ArithmeticOperator.AddId: { _value = Add(left, right); break; } case ArithmeticOperator.SubtractId: { _value = Subtract(left, right); break; } case ArithmeticOperator.MultiplyId: { _value = Multiply(left, right); break; } case ArithmeticOperator.DivideId: { _value = Divide(left, right); break; } case ArithmeticOperator.ModuloId: { _value = Modulo(left, right); break; } } }
public virtual void Visit(ArithmeticExpression operand) { operand.Left().Accept(this); operand.Right().Accept(this); }
public virtual void Visit(ArithmeticExpression operand) { var oldInArithmetic = _inArithmetic; _inArithmetic = true; operand.Left().Accept(this); operand.Right().Accept(this); var operandType = ArithmeticType(operand); switch (operand.Op().Id()) { case ArithmeticOperator.AddId: { _methodBuilder.Add(operandType); break; } case ArithmeticOperator.SubtractId: { _methodBuilder.Subtract(operandType); break; } case ArithmeticOperator.MultiplyId: { _methodBuilder.Multiply(operandType); break; } case ArithmeticOperator.DivideId: { _methodBuilder.Divide(operandType); break; } case ArithmeticOperator.ModuloId: { _methodBuilder.Modulo(operandType); break; } default: { throw new Exception("Unknown operand: " + operand.Op()); } } Box(_opClass, !oldInArithmetic); _inArithmetic = oldInArithmetic; }