use of org.sonar.java.model.expression.AssignmentExpressionTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method assignmentExpression.
// End of statements
// Expressions
public ExpressionTree assignmentExpression(ExpressionTree expression, Optional<List<OperatorAndOperand>> operatorAndOperands) {
if (!operatorAndOperands.isPresent()) {
return expression;
}
ExpressionTree result = null;
InternalSyntaxToken lastOperator = null;
for (OperatorAndOperand operatorAndOperand : Lists.reverse(operatorAndOperands.get())) {
if (lastOperator == null) {
result = operatorAndOperand.operand();
} else {
result = new AssignmentExpressionTreeImpl(kindMaps.getAssignmentOperator((JavaPunctuator) lastOperator.getGrammarRuleKey()), operatorAndOperand.operand(), lastOperator, result);
}
lastOperator = operatorAndOperand.operator();
}
result = new AssignmentExpressionTreeImpl(kindMaps.getAssignmentOperator((JavaPunctuator) lastOperator.getGrammarRuleKey()), expression, lastOperator, result);
return result;
}
Aggregations