Search in sources :

Example 31 with JCVariableDecl

use of org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCVariableDecl in project ceylon by eclipse.

the class NamedArgumentInvocation method appendDefaulted.

private final void appendDefaulted(Parameter param, JCExpression argExpr) {
    // we can't just generate types like Foo<?> if the target type param is not raw because the bounds will
    // not match, so we go raw
    int flags = JT_RAW;
    if (getNamedParameterBoxingStrategy(param) == BoxingStrategy.BOXED) {
        flags |= JT_TYPE_ARGUMENT;
    }
    Type type = gen.getTypeForParameter(param, producedReference, AbstractTransformer.TP_TO_BOUND);
    Naming.SyntheticName argName = argName(param);
    JCExpression typeExpr = gen.makeJavaType(type, flags);
    JCVariableDecl varDecl = gen.makeVar(argName, typeExpr, argExpr);
    bind(param, argName, gen.makeJavaType(type, flags), List.<JCStatement>of(varDecl));
}
Also used : Type(org.eclipse.ceylon.model.typechecker.model.Type) JCExpression(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCExpression) JCVariableDecl(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCVariableDecl)

Aggregations

JCVariableDecl (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCVariableDecl)31 JCExpression (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCExpression)25 JCTree (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)21 JCStatement (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCStatement)16 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)14 Type (org.eclipse.ceylon.model.typechecker.model.Type)12 SyntheticName (org.eclipse.ceylon.compiler.java.codegen.Naming.SyntheticName)10 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)7 JCBlock (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCBlock)6 ListBuffer (org.eclipse.ceylon.langtools.tools.javac.util.ListBuffer)6 CustomTree (org.eclipse.ceylon.compiler.typechecker.tree.CustomTree)5 Expression (org.eclipse.ceylon.compiler.typechecker.tree.Tree.Expression)5 JCCatch (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCCatch)5 JCNewClass (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCNewClass)5 Name (org.eclipse.ceylon.langtools.tools.javac.util.Name)5 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)4 CName (org.eclipse.ceylon.compiler.java.codegen.Naming.CName)3 Variable (org.eclipse.ceylon.compiler.typechecker.tree.Tree.Variable)3 JCAssign (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCAssign)3 JCMethodDecl (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCMethodDecl)3