use of org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation in project spoon by INRIA.
the class ParentExiter method visitCtBinaryOperator.
@Override
public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) {
if (child instanceof CtExpression) {
if (operator.getLeftHandOperand() == null) {
operator.setLeftHandOperand((CtExpression<?>) child);
return;
} else if (operator.getRightHandOperand() == null) {
operator.setRightHandOperand((CtExpression<?>) child);
return;
} else if (jdtTreeBuilder.getContextBuilder().stack.peek().node instanceof StringLiteralConcatenation) {
CtBinaryOperator<?> op = operator.getFactory().Core().createBinaryOperator();
op.setKind(BinaryOperatorKind.PLUS);
op.setLeftHandOperand(operator.getRightHandOperand());
op.setRightHandOperand((CtExpression<?>) child);
operator.setRightHandOperand(op);
int[] lineSeparatorPositions = this.jdtTreeBuilder.getContextBuilder().compilationunitdeclaration.compilationResult.lineSeparatorPositions;
SourcePosition leftPosition = op.getLeftHandOperand().getPosition();
SourcePosition rightPosition = op.getRightHandOperand().getPosition();
op.setPosition(op.getFactory().createSourcePosition(leftPosition.getCompilationUnit(), leftPosition.getSourceStart(), rightPosition.getSourceEnd(), lineSeparatorPositions));
return;
}
}
super.visitCtBinaryOperator(operator);
}
Aggregations