/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope) */ public boolean visit( SynchronizedStatement synchronizedStatement, BlockScope scope) { this.scribe.printNextToken(TerminalTokens.TokenNamesynchronized); final int line = this.scribe.line; this.scribe.printNextToken(TerminalTokens.TokenNameLPAREN, this.preferences.insert_space_before_opening_paren_in_synchronized); if (this.preferences.insert_space_after_opening_paren_in_synchronized) { this.scribe.space(); } synchronizedStatement.expression.traverse(this, scope); this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_synchronized); formatLeftCurlyBrace(line, this.preferences.brace_position_for_block); synchronizedStatement.block.traverse(this, scope); return false; }
protected void consumeStatementSynchronized() { // SynchronizedStatement ::= OnlySynchronized '(' Expression ')' Block //optimize the push/pop if (this.astLengthStack[this.astLengthPtr] == 0) { this.astLengthStack[this.astLengthPtr] = 1; this.expressionLengthPtr--; this.astStack[++this.astPtr] = new SynchronizedStatement( this.expressionStack[this.expressionPtr--], null, this.intStack[this.intPtr--], this.endStatementPosition); } else { this.expressionLengthPtr--; this.astStack[this.astPtr] = new SynchronizedStatement( this.expressionStack[this.expressionPtr--], (Block) this.astStack[this.astPtr], this.intStack[this.intPtr--], this.endStatementPosition); } this.modifiers = ClassFileConstants.AccDefault; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) }
@Override public void endVisit(SynchronizedStatement x, BlockScope scope) { try { JBlock block = pop(x.block); JExpression expression = pop(x.expression); block.addStmt(0, expression.makeStatement()); push(block); } catch (Throwable e) { throw translateException(x, e); } }
@Override public boolean visit(SynchronizedStatement node, BlockScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
@Override public boolean visit(SynchronizedStatement node, BlockScope scope) { setGeneratedBy(node, source); applyOffsetASTNode(node); return super.visit(node, scope); }