Search in sources :

Example 16 with Scope

use of net.sourceforge.pmd.lang.symboltable.Scope in project pmd by pmd.

the class ScopeAndDeclarationFinder method visit.

@Override
public Object visit(ASTPackageSpecification node, Object data) {
    createClassScope(node);
    Scope s = ((PLSQLNode) node.jjtGetParent()).getScope();
    s.addDeclaration(new ClassNameDeclaration(node));
    cont(node);
    return data;
}
Also used : Scope(net.sourceforge.pmd.lang.symboltable.Scope) PLSQLNode(net.sourceforge.pmd.lang.plsql.ast.PLSQLNode)

Example 17 with Scope

use of net.sourceforge.pmd.lang.symboltable.Scope in project pmd by pmd.

the class ScopeAndDeclarationFinder method visit.

@Override
public Object visit(ASTTriggerUnit node, Object data) {
    createClassScope(node);
    Scope s = ((PLSQLNode) node.jjtGetParent()).getScope();
    s.addDeclaration(new ClassNameDeclaration(node));
    cont(node);
    return data;
}
Also used : Scope(net.sourceforge.pmd.lang.symboltable.Scope) PLSQLNode(net.sourceforge.pmd.lang.plsql.ast.PLSQLNode)

Example 18 with Scope

use of net.sourceforge.pmd.lang.symboltable.Scope in project pmd by pmd.

the class ScopeAndDeclarationFinder method visit.

@Override
public Object visit(ASTTypeSpecification node, Object data) {
    createClassScope(node);
    Scope s = ((PLSQLNode) node.jjtGetParent()).getScope();
    s.addDeclaration(new ClassNameDeclaration(node));
    cont(node);
    return data;
}
Also used : Scope(net.sourceforge.pmd.lang.symboltable.Scope) PLSQLNode(net.sourceforge.pmd.lang.plsql.ast.PLSQLNode)

Example 19 with Scope

use of net.sourceforge.pmd.lang.symboltable.Scope in project pmd by pmd.

the class ScopeAndDeclarationFinder method createSourceFileScope.

/**
 * Creates a new global scope for an AST node. The new scope is stored on
 * the scope stack.
 *
 * @param node
 *            the AST node for which the scope has to be created.
 */
private void createSourceFileScope(ASTInput node) {
    // When we do full symbol resolution, we'll need to add a truly
    // top-level GlobalScope.
    Scope scope;
    // %TODO generate a SchemaScope, based on inferred or explcitly
    // specified SchemaName
    // node.getPackageDeclaration();
    ASTObjectDeclaration n = null;
    if (n != null) {
        scope = new SourceFileScope(n.jjtGetChild(0).getImage());
    } else {
        scope = new SourceFileScope();
    }
    scopes.push(scope);
    node.setScope(scope);
}
Also used : ASTObjectDeclaration(net.sourceforge.pmd.lang.plsql.ast.ASTObjectDeclaration) Scope(net.sourceforge.pmd.lang.symboltable.Scope)

Aggregations

Scope (net.sourceforge.pmd.lang.symboltable.Scope)19 List (java.util.List)9 NameDeclaration (net.sourceforge.pmd.lang.symboltable.NameDeclaration)8 Test (org.junit.Test)5 Map (java.util.Map)4 PLSQLNode (net.sourceforge.pmd.lang.plsql.ast.PLSQLNode)4 NameOccurrence (net.sourceforge.pmd.lang.symboltable.NameOccurrence)4 Node (net.sourceforge.pmd.lang.ast.Node)3 ASTName (net.sourceforge.pmd.lang.java.ast.ASTName)3 ArrayList (java.util.ArrayList)2 ASTArgumentList (net.sourceforge.pmd.lang.java.ast.ASTArgumentList)2 ASTExtendsList (net.sourceforge.pmd.lang.java.ast.ASTExtendsList)2 ASTImplementsList (net.sourceforge.pmd.lang.java.ast.ASTImplementsList)2 ASTMethodDeclaration (net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration)2 AbstractJavaNode (net.sourceforge.pmd.lang.java.ast.AbstractJavaNode)2 JavaNode (net.sourceforge.pmd.lang.java.ast.JavaNode)2 VariableNameDeclaration (net.sourceforge.pmd.lang.java.symboltable.VariableNameDeclaration)2 HashSet (java.util.HashSet)1 ASTAllocationExpression (net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression)1 ASTBlock (net.sourceforge.pmd.lang.java.ast.ASTBlock)1