Example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation getExpression

List of usage examples for org.eclipse.jdt.core.dom SuperConstructorInvocation getExpression

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation getExpression.

Prototype

public Expression getExpression() 

Source Link

Document

Returns the expression of this super constructor invocation statement, or null if there is none.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(SuperConstructorInvocation node) {
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        this.fBuffer.append(".");//$NON-NLS-1$
    }//from  ww  w  .j av  a 2s. c  o  m
    if (node.getAST().apiLevel() >= JLS3) {
        if (!node.typeArguments().isEmpty()) {
            this.fBuffer.append("<");//$NON-NLS-1$
            for (Iterator<Type> it = node.typeArguments().iterator(); it.hasNext();) {
                Type t = it.next();
                t.accept(this);
                if (it.hasNext()) {
                    this.fBuffer.append(",");//$NON-NLS-1$
                }
            }
            this.fBuffer.append(">");//$NON-NLS-1$
        }
    }
    this.fBuffer.append("super(");//$NON-NLS-1$
    for (Iterator<Expression> it = node.arguments().iterator(); it.hasNext();) {
        Expression e = it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.fBuffer.append(",");//$NON-NLS-1$
        }
    }
    this.fBuffer.append(");");//$NON-NLS-1$
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(SuperConstructorInvocation node) {
    boa.types.Ast.Statement.Builder b = boa.types.Ast.Statement.newBuilder();
    //      b.setPosition(pos.build());
    List<boa.types.Ast.Statement> list = statements.peek();
    b.setKind(boa.types.Ast.Statement.StatementKind.EXPRESSION);
    boa.types.Ast.Expression.Builder eb = boa.types.Ast.Expression.newBuilder();
    //      eb.setPosition(pos.build());//FIXME
    eb.setKind(boa.types.Ast.Expression.ExpressionKind.METHODCALL);
    eb.setMethod("super");
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        eb.addExpressions(expressions.pop());
    }/*from w  ww.  j  a va2  s  .co m*/
    for (Object a : node.arguments()) {
        ((org.eclipse.jdt.core.dom.Expression) a).accept(this);
        eb.addMethodArgs(expressions.pop());
    }
    for (Object t : node.typeArguments()) {
        boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder();
        tb.setName(getIndex(typeName((org.eclipse.jdt.core.dom.Type) t)));
        tb.setKind(boa.types.Ast.TypeKind.GENERIC);
        eb.addGenericParameters(tb.build());
    }
    b.setExpression(eb.build());
    list.add(b.build());
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    printIndent();//  w ww.  ja v a 2 s .c o  m
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }
    if (node.getAST().apiLevel() >= AST.JLS3) {
        if (!node.typeArguments().isEmpty()) {
            this.buffer.append("<");//$NON-NLS-1$
            for (Iterator it = node.typeArguments().iterator(); it.hasNext();) {
                Type t = (Type) it.next();
                t.accept(this);
                if (it.hasNext()) {
                    this.buffer.append(",");//$NON-NLS-1$
                }
            }
            this.buffer.append(">");//$NON-NLS-1$
        }
    }
    this.buffer.append("super(");//$NON-NLS-1$
    for (Iterator it = node.arguments().iterator(); it.hasNext();) {
        Expression e = (Expression) it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }
    }
    this.buffer.append(");\n");//$NON-NLS-1$
    return false;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(SuperConstructorInvocation node) {
    sb.printIndent();/*from   w  w w.j a va2 s .  c om*/
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        sb.print(".");
    }
    printTypeParameters(node.getMethodBinding().getTypeParameters());
    sb.print("super(");
    for (Iterator<Expression> it = node.getArguments().iterator(); it.hasNext();) {
        it.next().accept(this);
        if (it.hasNext()) {
            sb.print(',');
        }
    }
    sb.println(");");
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link SuperConstructorInvocation}s. */
@Override/*from  w  w w .j a v a  2 s. co m*/
public boolean visit(SuperConstructorInvocation node) {
    sync(node);
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        token(".");
    }
    addTypeArguments(node.typeArguments(), plusFour);
    token("super");
    addArguments(node.arguments(), plusFour);
    token(";");
    return false;
}

From source file:edu.cmu.cs.crystal.cfg.eclipse.EclipseCFG.java

License:Open Source License

@Override
public void endVisit(SuperConstructorInvocation node) {
    EclipseCFGNode constructor = nodeMap.get(node);
    EclipseCFGNode exp = nodeMap.get(node.getExpression());

    makeListEdges(exp, (List<ASTNode>) node.arguments(), constructor);
}

From source file:edu.cmu.cs.crystal.internal.ControlFlowVisitor.java

License:Open Source License

/**
 * Example: super(arg1);/*from  w  w w.j av  a2 s. c om*/
 */
public boolean visit(SuperConstructorInvocation node) {
    Expression expression = node.getExpression();
    List arguments = node.arguments();
    ControlFlowNode expressioncfn = null, last = null;
    List<ControlFlowNode> cfns = null;

    if (expression != null) {
        expressioncfn = controlFlowNode.newControlFlowNode(expression);
        controlFlowNode.moveEdges(ControlFlowNode.Direction.BACKWARDS, expressioncfn);
        last = expressioncfn;
    }

    if (arguments != null && arguments.size() > 0) {
        // Take the argument list and make more CFNs from them.
        cfns = createCFNListFromASTNodeList(arguments);
        if (expression == null)
            controlFlowNode.moveEdges(ControlFlowNode.Direction.BACKWARDS, cfns.get(0));
        else
            expressioncfn.addEdge(ControlFlowNode.Direction.FORWARDS, cfns.get(0));
        last = cfns.get(cfns.size() - 1);
    }

    if (last == null)
        return false;
    last.addEdge(ControlFlowNode.Direction.FORWARDS, controlFlowNode);

    if (expressioncfn != null)
        expressioncfn.evaluate();
    if (cfns != null)
        evaluate(cfns);

    return false;
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.SuperConstructorInvocation node) {
    SuperConstructorInvocation element = (SuperConstructorInvocation) this.binding.get(node);
    this.initializeNode(element, node);

    if (this.binding.get(node.getExpression()) != null)
        element.setExpression((Expression) this.binding.get(node.getExpression()));
    for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) {
        Expression itElement = (Expression) this.binding.get(i.next());
        if (itElement != null)
            element.getArguments().add(itElement);
    }// ww  w.  j  av a 2 s .  co m
    NamedElementRef constructorRef = this.factory.createNamedElementRef();
    element.setMethod(constructorRef);
    JDTVisitorUtils.manageBindingRef(constructorRef, node, this);

}

From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    IValue expression = node.getExpression() == null ? null : visitChild(node.getExpression());

    IValueList genericTypes = new IValueList(values);
    if (node.getAST().apiLevel() >= AST.JLS3) {
        if (!node.typeArguments().isEmpty()) {
            for (Iterator it = node.typeArguments().iterator(); it.hasNext();) {
                Type t = (Type) it.next();
                genericTypes.add(visitChild(t));
            }//from   w ww. j  a  va  2s  .  co m
        }
    }

    IValueList arguments = new IValueList(values);
    for (Iterator it = node.arguments().iterator(); it.hasNext();) {
        Expression e = (Expression) it.next();
        arguments.add(visitChild(e));
    }

    ownValue = constructRascalNode(node, optional(expression), genericTypes.asList(), arguments.asList());
    return false;
}

From source file:org.codemucker.jmutate.ast.JAstFlattener.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    printIndent();//  www .ja  v a  2 s .c o  m
    if (node.getExpression() != null) {
        node.getExpression().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }
    if (node.getAST().apiLevel() >= JLS3) {
        if (!node.typeArguments().isEmpty()) {
            this.buffer.append("<");//$NON-NLS-1$
            for (Iterator it = node.typeArguments().iterator(); it.hasNext();) {
                Type t = (Type) it.next();
                t.accept(this);
                if (it.hasNext()) {
                    this.buffer.append(",");//$NON-NLS-1$
                }
            }
            this.buffer.append(">");//$NON-NLS-1$
        }
    }
    this.buffer.append("super(");//$NON-NLS-1$
    for (Iterator it = node.arguments().iterator(); it.hasNext();) {
        Expression e = (Expression) it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }
    }
    this.buffer.append(");\n");//$NON-NLS-1$
    return false;
}