use of com.google.devtools.j2objc.ast.CreationReference in project j2objc by google.
the class TreeConverter method convertMemberReference.
private TreeNode convertMemberReference(JCTree.JCMemberReference node) {
Element element = node.sym;
SourcePosition pos = getPosition(node);
if (ElementUtil.isConstructor(element)) {
CreationReference newNode = new CreationReference();
convertMethodReference(node, newNode);
return newNode.setType(Type.newType(nameType(node.expr)));
}
if (node.hasKind(JCTree.JCMemberReference.ReferenceKind.SUPER)) {
SuperMethodReference newNode = new SuperMethodReference();
convertMethodReference(node, newNode);
if (node.getQualifierExpression().getKind() == Kind.IDENTIFIER) {
// super::foo
return newNode;
} else {
// Qualifier expression is <name>."super", so it's always a JCFieldAccess.
JCTree.JCFieldAccess expr = (JCTree.JCFieldAccess) node.getQualifierExpression();
return newNode.setQualifier(convertSimpleName(nameSymbol(expr.selected), expr.type, getPosition(expr.selected)));
}
}
if (node.hasKind(JCTree.JCMemberReference.ReferenceKind.UNBOUND) || node.hasKind(JCTree.JCMemberReference.ReferenceKind.STATIC)) {
TypeMethodReference newNode = new TypeMethodReference();
convertMethodReference(node, newNode);
return newNode.setName(convertSimpleName(node.sym, node.type, pos)).setType(convertType(node.type, pos, false));
}
ExpressionMethodReference newNode = new ExpressionMethodReference();
convertMethodReference(node, newNode);
return newNode.setName(convertSimpleName(node.sym, node.type, pos)).setExpression((Expression) convert(node.getQualifierExpression()));
}
use of com.google.devtools.j2objc.ast.CreationReference in project j2objc by google.
the class TreeConverter method convertCreationReference.
private static TreeNode convertCreationReference(org.eclipse.jdt.core.dom.CreationReference node) {
CreationReference newNode = new CreationReference();
convertMethodReference(node, newNode, node.resolveMethodBinding(), false);
return newNode.setType((Type) TreeConverter.convert(node.getType()));
}
Aggregations