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);
}
}
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);
}
}
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);
}
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);
}
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;
}
}
Aggregations