Example usage for org.eclipse.jdt.internal.compiler.ast StringLiteralConcatenation computeConstant

List of usage examples for org.eclipse.jdt.internal.compiler.ast StringLiteralConcatenation computeConstant

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast StringLiteralConcatenation computeConstant.

Prototype

public void computeConstant() 

Source Link

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public InfixExpression convert(StringLiteralConcatenation expression) {
    expression.computeConstant();
    final InfixExpression infixExpression = new InfixExpression(this.ast);
    infixExpression.setOperator(InfixExpression.Operator.PLUS);
    org.eclipse.jdt.internal.compiler.ast.Expression[] stringLiterals = expression.literals;
    infixExpression.setLeftOperand(convert(stringLiterals[0]));
    infixExpression.setRightOperand(convert(stringLiterals[1]));
    for (int i = 2; i < expression.counter; i++) {
        infixExpression.extendedOperands().add(convert(stringLiterals[i]));
    }/*from  w ww  . j  ava 2s.c  o m*/
    if (this.resolveBindings) {
        this.recordNodes(infixExpression, expression);
    }
    infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
    return infixExpression;
}