public override void VisitMultiplicativeExpression(IMultiplicativeExpression expr, IList <IStatement> context) { foreach (var csExpr in expr.OperatorOperands) { csExpr.Accept(this, context); } }
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); }
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) }); }
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)); }
public MultiplicationOrderQuickFix(InefficientMultiplicationOrderWarning warning) { myExpression = warning.Expression; }