List of usage examples for org.eclipse.jdt.internal.compiler.ast CompoundAssignment CompoundAssignment
public CompoundAssignment(Expression lhs, Expression expression, int operator, int sourceEnd)
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected void consumeAssignment() { // Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression //optimize the push/pop int op = this.intStack[this.intPtr--]; //<--the encoded operator this.expressionPtr--; this.expressionLengthPtr--; Expression expression = this.expressionStack[this.expressionPtr + 1]; this.expressionStack[this.expressionPtr] = (op != EQUAL) ? new CompoundAssignment(this.expressionStack[this.expressionPtr], expression, op, expression.sourceEnd) : new Assignment(this.expressionStack[this.expressionPtr], expression, expression.sourceEnd); if (this.pendingRecoveredType != null) { // Used only in statements recovery. // This is not a real assignment but a placeholder for an existing anonymous type. // The assignment must be replace by the anonymous type. if (this.pendingRecoveredType.allocation != null && this.scanner.startPosition - 1 <= this.pendingRecoveredType.declarationSourceEnd) { this.expressionStack[this.expressionPtr] = this.pendingRecoveredType.allocation; this.pendingRecoveredType = null; return; }/*from ww w. j av a 2 s . com*/ this.pendingRecoveredType = null; } }
From source file:org.nabucco.framework.mda.template.java.extract.statement.JavaAstStatementExtractorVisitor.java
License:Open Source License
@Override public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) { Expression lhs = copy(compoundAssignment.lhs, scope); Expression expression = copy(compoundAssignment.expression, scope); CompoundAssignment compoundCopy = new CompoundAssignment(lhs, expression, 0, compoundAssignment.sourceEnd); this.statement = compoundCopy; return false; }