01: package org.acm.seguin.pmd.symboltable;
02:
03: import net.sourceforge.jrefactory.ast.ASTMethodDeclarator;
04: import net.sourceforge.jrefactory.ast.ASTVariableDeclaratorId;
05: import net.sourceforge.jrefactory.parser.ChildrenVisitor;
06:
07: public class DeclarationFinder extends ChildrenVisitor {
08:
09: public Object visit(ASTVariableDeclaratorId node, Object data) {
10: ((Scope) node.getScope())
11: .addDeclaration(new VariableNameDeclaration(node));
12: return super .visit(node, data);
13: }
14:
15: public Object visit(ASTMethodDeclarator node, Object data) {
16: ((Scope) node.getScope()).getEnclosingClassScope()
17: .addDeclaration(new MethodNameDeclaration(node));
18: return super.visit(node, data);
19: }
20: }
|