edu.mit.ai.psg.jeva
Class EnvBase

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.EnvBase
Direct Known Subclasses:
EnvLocalStore, EnvOptionBits, EnvProcedureBoundary, EnvThis

public abstract class EnvBase
extends Object
implements IEnv

A base class for Environment nodes that forwards all requests to the next environment node. Subclasses should override some methods to actually do some kinds of lookups. (Environments are chains of binding nodes).


Inner classes inherited from class edu.mit.ai.psg.jeva.IEnv
IEnv.ClassResult
 
Constructor Summary
EnvBase(IEnv nextEnv)
           
 
Method Summary
 IEnv getNext()
          get next env in chain; used by lookup methods
 int getOptionBits()
          get option bits; for options, see JevaES
 IEnv.ClassResult lookupClass(String queryName)
          find root class with this name; nested classes found from parent.
 IClass lookupEnclosingClass()
          return enclosing class, or null if not in a class.
 IPackage lookupEnclosingPackage()
          return enclosing package
 IField lookupField(String queryName)
          lookup field name in current class, or return null if no such field, or no current class.
 IStatementNode lookupLabel(String queryName, boolean isForContinue)
          if label found, return node of statement it labels; stops at method or initializer boundary.
 IStore lookupLocal(String queryName)
          lookup restricted to local variables and parameters, e.g., to check if a local variable name is already in use.
 IPackage lookupPackage(String rootPackageName)
          find root package with this name; sub-packages found from parent
 IClass lookupReturnType()
          return type of enclosing method, or void.class (wrapped) if in a constructor, or null if in a static or object initializer
 Object lookupThis()
          return "this", or null if not in non-static context (method, constructor, non-static initializer)
 IClass[] lookupThrows()
          find checked exceptions caught in an enclosing try block or declared in throws clause of enclosing method or constructor
abstract  String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnvBase

public EnvBase(IEnv nextEnv)
        throws IllegalArgumentException
Method Detail

getNext

public final IEnv getNext()
Description copied from interface: IEnv
get next env in chain; used by lookup methods
Specified by:
getNext in interface IEnv

toString

public abstract String toString()
Overrides:
toString in class Object

lookupLocal

public IStore lookupLocal(String queryName)
Description copied from interface: IEnv
lookup restricted to local variables and parameters, e.g., to check if a local variable name is already in use. Local scope may be a method, constructor, field initializer, static initializer, object initializer. [JavaLangSpec1.0sec14.3.2]
Specified by:
lookupLocal in interface IEnv

lookupField

public IField lookupField(String queryName)
                   throws IllegalAccessException
Description copied from interface: IEnv
lookup field name in current class, or return null if no such field, or no current class.
Specified by:
lookupField in interface IEnv
Tags copied from interface: IEnv
Throws:
IllegalAccessException - if there is a field with that name but it is inaccessible from the current class
IllegalArgumentException - if different fields with that name are inherited from an interface and either a superclass or another interface. (Fields are different if they are declared in different classes or interfaces.)

lookupLabel

public IStatementNode lookupLabel(String queryName,
                                  boolean isForContinue)
Description copied from interface: IEnv
if label found, return node of statement it labels; stops at method or initializer boundary. If label is empty (""), then returns first for, do, while, or switch statement. If isForContinue, then skip unlabeled switch statements.
Specified by:
lookupLabel in interface IEnv

lookupClass

public IEnv.ClassResult lookupClass(String queryName)
Description copied from interface: IEnv
find root class with this name; nested classes found from parent. Returns IEnv.ClassResult if found, else null;
Specified by:
lookupClass in interface IEnv
Tags copied from interface: IEnv
Throws:
IllegalArgumentException - if two on-demand-imports import different classes named queryName.
IllegalStateException - if env has conflicting definitions or class imports for queryName.

lookupPackage

public IPackage lookupPackage(String rootPackageName)
Description copied from interface: IEnv
find root package with this name; sub-packages found from parent
Specified by:
lookupPackage in interface IEnv

lookupReturnType

public IClass lookupReturnType()
Description copied from interface: IEnv
return type of enclosing method, or void.class (wrapped) if in a constructor, or null if in a static or object initializer
Specified by:
lookupReturnType in interface IEnv

lookupThrows

public IClass[] lookupThrows()
Description copied from interface: IEnv
find checked exceptions caught in an enclosing try block or declared in throws clause of enclosing method or constructor
Specified by:
lookupThrows in interface IEnv

lookupThis

public Object lookupThis()
Description copied from interface: IEnv
return "this", or null if not in non-static context (method, constructor, non-static initializer)
Specified by:
lookupThis in interface IEnv

lookupEnclosingClass

public IClass lookupEnclosingClass()
Description copied from interface: IEnv
return enclosing class, or null if not in a class.
Specified by:
lookupEnclosingClass in interface IEnv

lookupEnclosingPackage

public IPackage lookupEnclosingPackage()
Description copied from interface: IEnv
return enclosing package
Specified by:
lookupEnclosingPackage in interface IEnv

getOptionBits

public int getOptionBits()
Description copied from interface: IEnv
get option bits; for options, see JevaES
Specified by:
getOptionBits in interface IEnv

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu