Search in sources :

Example 1 with ASTPrimarySuffix

use of net.sourceforge.pmd.lang.plsql.ast.ASTPrimarySuffix in project pmd by pmd.

the class NameFinder method checkForNameChild.

private void checkForNameChild(Node node) {
    if (node.getImage() != null) {
        add(new PLSQLNameOccurrence((PLSQLNode) node, node.getImage()));
    }
    if (node.jjtGetNumChildren() > 0 && node.jjtGetChild(0) instanceof ASTName) {
        ASTName grandchild = (ASTName) node.jjtGetChild(0);
        for (StringTokenizer st = new StringTokenizer(grandchild.getImage(), "."); st.hasMoreTokens(); ) {
            add(new PLSQLNameOccurrence(grandchild, st.nextToken()));
        }
    }
    if (node instanceof ASTPrimarySuffix) {
        ASTPrimarySuffix suffix = (ASTPrimarySuffix) node;
        if (suffix.isArguments()) {
            PLSQLNameOccurrence occurrence = names.get(names.size() - 1);
            occurrence.setIsMethodOrConstructorInvocation();
            ASTArguments args = (ASTArguments) ((ASTPrimarySuffix) node).jjtGetChild(0);
            occurrence.setArgumentCount(args.getArgumentCount());
        }
    // else if (suffix.jjtGetNumChildren() == 1
    // && suffix.jjtGetChild(0) instanceof ASTMemberSelector)
    // {
    // add(new NameOccurrence((SimpleNode)suffix.jjtGetChild(0),
    // suffix.jjtGetChild(0).getImage()));
    // }
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) ASTName(net.sourceforge.pmd.lang.plsql.ast.ASTName) PLSQLNode(net.sourceforge.pmd.lang.plsql.ast.PLSQLNode) ASTArguments(net.sourceforge.pmd.lang.plsql.ast.ASTArguments) ASTPrimarySuffix(net.sourceforge.pmd.lang.plsql.ast.ASTPrimarySuffix)

Aggregations

StringTokenizer (java.util.StringTokenizer)1 ASTArguments (net.sourceforge.pmd.lang.plsql.ast.ASTArguments)1 ASTName (net.sourceforge.pmd.lang.plsql.ast.ASTName)1 ASTPrimarySuffix (net.sourceforge.pmd.lang.plsql.ast.ASTPrimarySuffix)1 PLSQLNode (net.sourceforge.pmd.lang.plsql.ast.PLSQLNode)1