Search in sources :

Example 81 with JCTree

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

the class Pretty method visitNewArray.

public void visitNewArray(JCNewArray tree) {
    try {
        if (tree.elemtype != null) {
            print("new ");
            JCTree elem = tree.elemtype;
            printBaseElementType(elem);
            if (!tree.annotations.isEmpty()) {
                print(' ');
                printTypeAnnotations(tree.annotations);
            }
            if (tree.elems != null) {
                print("[]");
            }
            int i = 0;
            List<List<JCAnnotation>> da = tree.dimAnnotations;
            for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
                if (da.size() > i && !da.get(i).isEmpty()) {
                    print(' ');
                    printTypeAnnotations(da.get(i));
                }
                print("[");
                i++;
                printExpr(l.head);
                print("]");
            }
            printBrackets(elem);
        }
        if (tree.elems != null) {
            print("{");
            printExprs(tree.elems, true);
            print("}");
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : JCTree(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)

Example 82 with JCTree

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

the class Pretty method visitTry.

public void visitTry(JCTry tree) {
    try {
        print("try ");
        if (tree.resources.nonEmpty()) {
            print("(");
            boolean first = true;
            for (JCTree var : tree.resources) {
                if (!first) {
                    println();
                    indent();
                }
                printStat(var);
                first = false;
            }
            print(") ");
        }
        printStat(tree.body);
        for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
            printStat(l.head);
        }
        if (tree.finalizer != null) {
            print(" finally ");
            printStat(tree.finalizer);
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : JCTree(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)

Example 83 with JCTree

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

the class TreeCopier method visitTypeCast.

public JCTree visitTypeCast(TypeCastTree node, P p) {
    JCTypeCast t = (JCTypeCast) node;
    JCTree clazz = copy(t.clazz, p);
    JCExpression expr = copy(t.expr, p);
    return M.at(t.pos).TypeCast(clazz, expr);
}
Also used : JCTree(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)

Example 84 with JCTree

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

the class TreeCopier method visitInstanceOf.

public JCTree visitInstanceOf(InstanceOfTree node, P p) {
    JCInstanceOf t = (JCInstanceOf) node;
    JCExpression expr = copy(t.expr, p);
    JCTree clazz = copy(t.clazz, p);
    return M.at(t.pos).TypeTest(expr, clazz);
}
Also used : JCTree(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)

Example 85 with JCTree

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

the class TreeCopier method visitAnnotation.

public JCTree visitAnnotation(AnnotationTree node, P p) {
    JCAnnotation t = (JCAnnotation) node;
    JCTree annotationType = copy(t.annotationType, p);
    List<JCExpression> args = copy(t.args, p);
    if (t.getKind() == Tree.Kind.TYPE_ANNOTATION) {
        JCAnnotation newTA = M.at(t.pos).TypeAnnotation(annotationType, args);
        newTA.attribute = t.attribute;
        return newTA;
    } else {
        JCAnnotation newT = M.at(t.pos).Annotation(annotationType, args);
        newT.attribute = t.attribute;
        return newT;
    }
}
Also used : JCTree(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)

Aggregations

JCTree (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree)101 JCExpression (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCExpression)19 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)18 Symbol (org.eclipse.ceylon.langtools.tools.javac.code.Symbol)12 JCVariableDecl (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCVariableDecl)10 JCStatement (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCStatement)9 JavaFileObject (org.eclipse.ceylon.javax.tools.JavaFileObject)8 Type (org.eclipse.ceylon.langtools.tools.javac.code.Type)8 JCNewClass (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCNewClass)8 ListBuffer (org.eclipse.ceylon.langtools.tools.javac.util.ListBuffer)8 SyntheticName (org.eclipse.ceylon.compiler.java.codegen.Naming.SyntheticName)7 Type (org.eclipse.ceylon.model.typechecker.model.Type)6 JCAnnotation (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCAnnotation)5 JCBlock (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCBlock)4 JCClassDecl (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCClassDecl)4 JCCompilationUnit (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCCompilationUnit)4 JCPrimitiveTypeTree (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCPrimitiveTypeTree)4 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)4 IOException (java.io.IOException)3 TaskEvent (org.eclipse.ceylon.langtools.source.util.TaskEvent)3