use of com.google.devtools.j2objc.ast.ArrayType in project j2objc by google.
the class TreeConverter method convertArrayType.
private TreeNode convertArrayType(JCTree.JCArrayTypeTree node) {
ArrayType newNode = new ArrayType();
Type componentType = (Type) Type.newType(node.getType().type);
return newNode.setComponentType(componentType).setTypeMirror(node.type);
}
use of com.google.devtools.j2objc.ast.ArrayType in project j2objc by google.
the class TreeConverter method convertNewArray.
private TreeNode convertNewArray(JCTree.JCNewArray node) {
ArrayCreation newNode = new ArrayCreation();
List<Expression> dimensions = new ArrayList<>();
for (JCTree.JCExpression dimension : node.getDimensions()) {
dimensions.add((Expression) convert(dimension));
}
javax.lang.model.type.ArrayType type = (javax.lang.model.type.ArrayType) node.type;
if (node.getInitializers() != null) {
ArrayInitializer initializers = new ArrayInitializer(type);
for (JCTree.JCExpression initializer : node.getInitializers()) {
initializers.addExpression((Expression) convert(initializer));
}
newNode.setInitializer(initializers);
}
return newNode.setType((ArrayType) new ArrayType(type).setPosition(getPosition(node))).setDimensions(dimensions);
}
use of com.google.devtools.j2objc.ast.ArrayType in project j2objc by google.
the class TreeConverter method convertArrayType.
private static TreeNode convertArrayType(org.eclipse.jdt.core.dom.ArrayType node) {
ArrayType newNode = new ArrayType();
convertType(node, newNode);
// This could also be implemented as an element type and dimensions for JLS8, but we mainly deal
// with ArrayTypes through the ArrayType(ITypeBinding) initializer, in the ArrayRewriter, for
// which we use ITypeBinding's componentType anyway.
Type componentType = (Type) Type.newType(BindingConverter.getType(node.resolveBinding().getComponentType()));
return newNode.setComponentType(componentType);
}
Aggregations