@Override public JCExpressionStatement inline(Inliner inliner) throws CouldNotResolveImportException { return inliner.maker().Exec(getExpression().inline(inliner)); }
@Override public List<JCStatement> inlineStatements(final Inliner inliner) throws CouldNotResolveImportException { try { Optional<List<JCStatement>> binding = inliner.getOptionalBinding(placeholder().blockKey()); // If a placeholder was used as an expression binding in the @BeforeTemplate, // and as a bare statement or as a return in the @AfterTemplate, we may need to convert. Optional<JCExpression> exprBinding = inliner.getOptionalBinding(placeholder().exprKey()); binding = binding.or( exprBinding.transform( (JCExpression expr) -> { switch (implementationFlow()) { case NEVER_EXITS: return List.of((JCStatement) inliner.maker().Exec(expr)); case ALWAYS_RETURNS: return List.of((JCStatement) inliner.maker().Return(expr)); default: throw new AssertionError(); } })); return UPlaceholderExpression.copier(arguments(), inliner).copy(binding.get(), inliner); } catch (UncheckedCouldNotResolveImportException e) { throw e.getCause(); } } }
/** Wrap a method invocation in an expression statement or return statement, * depending on whether the method invocation expression's type is void. */ public JCStatement Call(JCExpression apply) { return apply.type.tag == VOID ? Exec(apply) : Return(apply); }
/** Wrap a method invocation in an expression statement or return statement, * depending on whether the method invocation expression's type is void. */ public JCStatement Call(JCExpression apply) { return apply.type.tag == VOID ? Exec(apply) : Return(apply); }
public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) { JCExpressionStatement t = (JCExpressionStatement) node; JCExpression expr = copy(t.expr, p); return M.at(t.pos).Exec(expr); }
public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) { JCExpressionStatement t = (JCExpressionStatement) node; JCExpression expr = copy(t.expr, p); return M.at(t.pos).Exec(expr); }
/** Wrap a method invocation in an expression statement or return statement, * depending on whether the method invocation expression's type is void. */ public JCStatement Call(JCExpression apply) { return apply.type.hasTag(VOID) ? Exec(apply) : Return(apply); }
public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) { JCExpressionStatement t = (JCExpressionStatement) node; JCExpression expr = copy(t.expr, p); return M.at(t.pos).Exec(expr); }
/** Wrap a method invocation in an expression statement or return statement, * depending on whether the method invocation expression's type is void. */ public JCStatement Call(JCExpression apply) { return apply.type.hasTag(VOID) ? Exec(apply) : Return(apply); }
public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) { JCExpressionStatement t = (JCExpressionStatement) node; JCExpression expr = copy(t.expr, p); return M.at(t.pos).Exec(expr); }
/** Construct an assignment from a variable symbol and a right hand side. */ public JCStatement Assignment(Symbol v, JCExpression rhs) { return Exec(Assign(Ident(v), rhs).setType(v.type)); }
/** Construct an assignment from a variable symbol and a right hand side. */ public JCStatement Assignment(Symbol v, JCExpression rhs) { return Exec(Assign(Ident(v), rhs).setType(v.type)); }
/** Construct an assignment from a variable symbol and a right hand side. */ public JCStatement Assignment(Symbol v, JCExpression rhs) { return Exec(Assign(Ident(v), rhs).setType(v.type)); }
/** Construct an assignment from a variable symbol and a right hand side. */ public JCStatement Assignment(Symbol v, JCExpression rhs) { return Exec(Assign(Ident(v), rhs).setType(v.type)); }
@Override public JCExpressionStatement inline(Inliner inliner) throws CouldNotResolveImportException { return inliner.maker().Exec(getExpression().inline(inliner)); }
private JCStatement makeResourceCloseInvocation(JCExpression resource) { // convert to AutoCloseable if needed if (types.asSuper(resource.type, syms.autoCloseableType.tsym) == null) { resource = (JCExpression) convert(resource, syms.autoCloseableType); } // create resource.close() method invocation JCExpression resourceClose = makeCall(resource, names.close, List.<JCExpression>nil()); return make.Exec(resourceClose); }
private JCStatement makeResourceCloseInvocation(JCExpression resource) { // convert to AutoCloseable if needed if (types.asSuper(resource.type, syms.autoCloseableType.tsym) == null) { resource = (JCExpression) convert(resource, syms.autoCloseableType); } // create resource.close() method invocation JCExpression resourceClose = makeCall(resource, names.close, List.<JCExpression>nil()); return make.Exec(resourceClose); }
private JCTree.JCStatement buildBootstrapStaticBlock() { TreeMaker make = _javacJacker.getTreeMaker(); JavacElements javacElems = _javacJacker.getJavacElements(); JCTree.JCMethodInvocation bootstrapInitCall = make.Apply( List.nil(), memberAccess( make, javacElems, Bootstrap.class.getName() + ".init" ), List.nil() ); return make.Block( Modifier.STATIC, List.of( make.Exec( bootstrapInitCall ) ) ); }
private JCStatement doRecover(int startPos, ErrorRecoveryAction action, String key) { int errPos = S.errPos(); JCTree stm = action.doRecover(this); S.errPos(errPos); return toP(F.Exec(syntaxError(startPos, List.<JCTree>of(stm), key))); }
private JCStatement doRecover(int startPos, ErrorRecoveryAction action, String key) { int errPos = S.errPos(); JCTree stm = action.doRecover(this); S.errPos(errPos); return toP(F.Exec(syntaxError(startPos, List.<JCTree>of(stm), key))); }