static <T extends Statement> Statement accept(T node, Shuttle shuttle) { if (node == null) { return null; } return node.accept(shuttle); }
public R visit(TryStatement tryStatement) { R r = tryStatement.body.accept(this); for (CatchBlock catchBlock : tryStatement.catchBlocks) { r = catchBlock.parameter.accept(this); r = catchBlock.body.accept(this); } if (tryStatement.fynally != null) { r = tryStatement.fynally.accept(this); } return r; }
static List<Statement> acceptStatements(List<Statement> statements, Shuttle shuttle) { if (statements.isEmpty()) { return statements; // short cut } final List<Statement> statements1 = new ArrayList<>(); for (Statement statement : statements) { Statement newStatement = statement.accept(shuttle); if (newStatement instanceof GotoStatement) { GotoStatement goto_ = (GotoStatement) newStatement; if (goto_.kind == GotoExpressionKind.Sequence && goto_.expression == null) { // ignore empty statements continue; } } statements1.add(newStatement); } return statements1; }
public R visit(WhileStatement whileStatement) { R r0 = whileStatement.condition.accept(this); return whileStatement.body.accept(this); }
@Override void accept0(ExpressionWriter writer) { if (statements.isEmpty()) { writer.append("{}"); return; } writer.begin("{\n"); for (Statement node : statements) { node.accept(writer, 0, 0); } writer.end("}\n"); }
@Override public Statement accept(Shuttle shuttle) { shuttle = shuttle.preVisit(this); final Expression condition1 = condition.accept(shuttle); final Statement body1 = body.accept(shuttle); return shuttle.visit(this, condition1, body1); }
public R visit(ForStatement forStatement) { R r0 = Expressions.acceptNodes(forStatement.declarations, this); R r1 = forStatement.condition.accept(this); R r2 = forStatement.post.accept(this); return forStatement.body.accept(this); }
statement.accept(useCounter); Statement beforeOptimize = oldStatement; if (!subMap.isEmpty()) { oldStatement = oldStatement.accept(visitor); // remap oldStatement = oldStatement.accept(optimizer); if (beforeOptimize != oldStatement) { ++optimizeCount; Statement beforeOptimize = oldStatement; if (!subMap.isEmpty()) { oldStatement = oldStatement.accept(visitor); // remap oldStatement = oldStatement.accept(optimizer); if (beforeOptimize != oldStatement) { ++optimizeCount;
@Override public ForStatement accept(Shuttle shuttle) { shuttle = shuttle.preVisit(this); List<DeclarationStatement> decls1 = Expressions.acceptDeclarations(declarations, shuttle); final Expression condition1 = condition == null ? null : condition.accept(shuttle); final Expression post1 = post == null ? null : post.accept(shuttle); final Statement body1 = body.accept(shuttle); return shuttle.visit(this, decls1, condition1, post1, body1); }
if (!replacements.isEmpty()) { statement = statement.accept(shuttle);