public override void VisitMultiplicativeExpression(IMultiplicativeExpression expr, IList <IStatement> context)
 {
     foreach (var csExpr in expr.OperatorOperands)
     {
         csExpr.Accept(this, context);
     }
 }
예제 #2
0
        private List <ICSharpExpression> GetAllOperands(IMultiplicativeExpression expression)
        {
            var result = new List <ICSharpExpression>();
            var left   = expression.LeftOperand.GetOperandThroughParenthesis();
            var right  = expression.RightOperand.GetOperandThroughParenthesis();

            if (left is IMultiplicativeExpression leftM)
            {
                result.AddRange(GetAllOperands(leftM));
            }
            else
            {
                result.Add(left);
            }

            if (right is IMultiplicativeExpression rightM)
            {
                result.AddRange(GetAllOperands(rightM));
            }
            else
            {
                result.Add(right);
            }

            return(result);
        }
예제 #3
0
        public override IAssignableExpression VisitMultiplicativeExpression(IMultiplicativeExpression expr,
                                                                            IList <IStatement> context)
        {
            BinaryOperator op = BinaryOperator.Unknown;

            if (expr.OperatorSign.NodeType == CSharpTokenType.PERC)
            {
                op = BinaryOperator.Modulo;
            }
            else if (expr.OperatorSign.NodeType == CSharpTokenType.DIV)
            {
                op = BinaryOperator.Divide;
            }
            else if (expr.OperatorSign.NodeType == CSharpTokenType.ASTERISK)
            {
                op = BinaryOperator.Multiply;
            }

            return(new BinaryExpression
            {
                LeftOperand = ToSimpleExpression(expr.LeftOperand, context),
                Operator = op,
                RightOperand = ToSimpleExpression(expr.RightOperand, context)
            });
        }
예제 #4
0
        private List <ICSharpExpression> GetAllOperands(IMultiplicativeExpression expression)
        {
            var result = new List <ICSharpExpression>();
            var left   = expression.LeftOperand.GetOperandThroughParenthesis();
            var right  = expression.RightOperand.GetOperandThroughParenthesis();

            if (left is IMultiplicativeExpression leftM && leftM.OperatorSign.GetTokenType() == CSharpTokenType.ASTERISK)
            {
                result.AddRange(GetAllOperands(leftM));
            }
예제 #5
0
 public MultiplicationOrderQuickFix(InefficientMultiplicationOrderWarning warning)
 {
     myExpression = warning.Expression;
 }