use of com.google.devtools.j2objc.ast.ClassInstanceCreation in project j2objc by google.
the class TreeConverter method convertClassInstanceCreation.
private static TreeNode convertClassInstanceCreation(org.eclipse.jdt.core.dom.ClassInstanceCreation node) {
ClassInstanceCreation newNode = new ClassInstanceCreation();
convertExpression(node, newNode);
for (Object argument : node.arguments()) {
newNode.addArgument((Expression) TreeConverter.convert(argument));
}
IMethodBinding binding = node.resolveConstructorBinding();
JdtExecutableElement element = (JdtExecutableElement) BindingConverter.getExecutableElement(binding);
JdtExecutableType type = BindingConverter.getType(binding);
newNode.setExecutablePair(new ExecutablePair(element, type)).setVarargsType(getVarargsType(binding, node.arguments())).setType((Type) TreeConverter.convert(node.getType()));
Expression expression = (Expression) TreeConverter.convert(node.getExpression());
org.eclipse.jdt.core.dom.AnonymousClassDeclaration anonymousClassDecl = node.getAnonymousClassDeclaration();
if (anonymousClassDecl != null && expression != null) {
VariableElement superOuterParam = GeneratedVariableElement.newParameter("superOuter$", expression.getTypeMirror(), element);
element.setSuperOuterParam(superOuterParam);
type.setSuperOuterParamType(superOuterParam.asType());
newNode.addArgument(0, expression);
} else {
newNode.setExpression(expression);
}
if (anonymousClassDecl != null) {
newNode.setAnonymousClassDeclaration(convertAnonymousClassDeclaration(anonymousClassDecl, element, binding));
}
return newNode;
}
Aggregations