01: package org.acm.seguin.pmd.symboltable;
02:
03: import java.util.Map;
04:
05: /**
06: * Provides methods which all scopes must implement
07: *
08: * See JLS 6.3 for a description of scopes
09: */
10: public interface Scope extends net.sourceforge.jrefactory.ast.Scope {
11: /**
12: * Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that
13: * exist and are either used or not used at this scope
14: */
15: Map getVariableDeclarations(boolean lookingForUsed);
16:
17: /**
18: * Add a variable declaration to this scope
19: */
20: void addDeclaration(VariableNameDeclaration decl);
21:
22: /**
23: * Add a method declaration to this scope
24: */
25: void addDeclaration(MethodNameDeclaration decl);
26:
27: /**
28: * Tests whether or not a NameOccurrence is directly contained in the scope
29: * Note that if this search is just in this scope - it doesn't go diving into any
30: * contained scopes.
31: */
32: boolean contains(NameOccurrence occ);
33:
34: /**
35: * Adds a NameOccurrence to this scope - only call this after getting
36: * a true back from contains()
37: */
38: NameDeclaration addVariableNameOccurrence(NameOccurrence occ);
39:
40: /**
41: * Points this scope to its parent
42: */
43: // void setParent(Scope parent);
44: /**
45: * Retrieves this scope's parent
46: */
47: // Scope getParent();
48: /**
49: * Goes searching up the tree for this scope's enclosing ClassScope
50: * This is handy if you're buried down in a LocalScope and need to
51: * hop up to the ClassScope to find a method name.
52: */
53: ClassScope getEnclosingClassScope();
54: }
|