use of com.strobel.decompiler.languages.java.ast.ArrayInitializerExpression in project j2objc by google.
the class MethodTranslator method visitArrayCreationExpression.
@Override
public TreeNode visitArrayCreationExpression(ArrayCreationExpression node, Void data) {
Type baseType = (Type) node.getType().acceptVisitor(this, null);
AstNodeCollection<com.strobel.decompiler.languages.java.ast.Expression> dimexprs = node.getDimensions();
ArrayInitializerExpression init = node.getInitializer();
ArrayType arrayType = new ArrayType(typeUtil.getArrayType(baseType.getTypeMirror(), dimexprs.size() + node.getAdditionalArraySpecifiers().size()));
if (init.isNull()) {
List<Expression> dimensions = dimexprs.stream().map(e -> (Expression) e.acceptVisitor(this, null)).collect(Collectors.toList());
return new ArrayCreation().setType(arrayType).setDimensions(dimensions);
} else {
ArrayInitializer arrayInit = (ArrayInitializer) init.acceptVisitor(this, null);
return new ArrayCreation().setType(arrayType).setInitializer(arrayInit.setTypeMirror(arrayType.getTypeMirror()));
}
}
Aggregations