net.sourceforge.pmd.lang.java.symboltable
Class MethodScope

java.lang.Object
  extended by net.sourceforge.pmd.lang.symboltable.AbstractScope
      extended by net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
          extended by net.sourceforge.pmd.lang.java.symboltable.MethodScope
All Implemented Interfaces:
Scope

public class MethodScope
extends AbstractJavaScope

A Method Scope can have variable declarations and class declarations within it.


Constructor Summary
MethodScope(Node node)
           
 
Method Summary
 void addDeclaration(NameDeclaration variableDecl)
          Adds a new declaration to this scope.
 NameDeclaration addNameOccurrence(NameOccurrence occurrence)
          Adds a NameOccurrence to this scope - only call this after getting a true back from Scope.contains(NameOccurrence).
 NameDeclaration findVariableHere(JavaNameOccurrence occurrence)
           
 String getName()
           
 Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()
           
 String toString()
           
 
Methods inherited from class net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
checkForDuplicatedNameDeclaration, contains, glomNames
 
Methods inherited from class net.sourceforge.pmd.lang.symboltable.AbstractScope
getDeclarations, getDeclarations, getEnclosingScope, getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodScope

public MethodScope(Node node)
Method Detail

getVariableDeclarations

public Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()

addNameOccurrence

public NameDeclaration addNameOccurrence(NameOccurrence occurrence)
Description copied from interface: Scope
Adds a NameOccurrence to this scope - only call this after getting a true back from Scope.contains(NameOccurrence).

Specified by:
addNameOccurrence in interface Scope
Overrides:
addNameOccurrence in class AbstractScope
Returns:
the NameDeclaration that is references by the given NameOccurrence, if the NameOccurrence could be added. Otherwise null is returned.

addDeclaration

public void addDeclaration(NameDeclaration variableDecl)
Description copied from interface: Scope
Adds a new declaration to this scope. Only after the declaration has been added, Scope.contains(NameOccurrence) and Scope.addNameOccurrence(NameOccurrence) can be used correctly.

Specified by:
addDeclaration in interface Scope
Overrides:
addDeclaration in class AbstractJavaScope
Parameters:
variableDecl - the declaration to add

findVariableHere

public NameDeclaration findVariableHere(JavaNameOccurrence occurrence)
Specified by:
findVariableHere in class AbstractJavaScope

getName

public String getName()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002–2015 InfoEther. All rights reserved.