01: package org.acm.seguin.pmd.symboltable;
02:
03: import org.acm.seguin.pmd.util.Applier;
04:
05: public class LocalScope extends AbstractScope {
06:
07: public void addDeclaration(VariableNameDeclaration nameDecl) {
08: if (nameDecl.isExceptionBlockParameter()) {
09: // this declaration needs to go somewhere... should this be delegated to the next
10: // highest LocalScope?
11: return;
12: }
13: super .addDeclaration(nameDecl);
14: }
15:
16: protected NameDeclaration findVariableHere(NameOccurrence occurrence) {
17: //System.err.println("LocalScope.findVariableHere("+occurrence+")");
18: if (occurrence.isThisOrSuper()) {
19: return null;
20: }
21: ImageFinderFunction finder = new ImageFinderFunction(occurrence
22: .getImage());
23: Applier.apply(finder, variableNames.keySet().iterator());
24: //System.err.println(" "+this);
25: return finder.getDecl();
26: }
27:
28: public String toString() {
29: return "LocalScope:" + super.glomNames();
30: }
31: }
|