edu.mit.ai.psg.jeva
Interface IEnv

All Known Implementing Classes:
EnvBase, EnvLocalStore, EnvEnd

public abstract interface IEnv

IEnv: Interface to objects in which names can be looked up. Environments are implemented as a chain, so each can pass the request on to the next if the queryName is not found.

Author:
CarlManning, caroma@ai.mit.edu
Copyright (c) 1997, 1998, 1999 Massachusetts Institute of Technology

Method Summary
 IEnv getNext()
          next env frame; used by lookup methods
 int getOptionBits()
          get option bits; for options, see JevaES
 IClass 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, used for checking 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
 

Method Detail

lookupLocal

public IStore lookupLocal(String queryName)
lookup restricted to local variables and parameters, used for checking 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]

lookupField

public IField lookupField(String queryName)
                   throws IllegalAccessException
lookup field name in current class, or return null if no such field, or no current class.
Throws:
IllegalAccessException - if there is a field with that name but it is inaccessible from the current class

lookupLabel

public IStatementNode lookupLabel(String queryName,
                                  boolean isForContinue)
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.

lookupClass

public IClass lookupClass(String queryName)
find root class with this name; nested classes found from parent.
Throws:
IllegalStateException - if duplicate names discovered.

lookupPackage

public IPackage lookupPackage(String rootPackageName)
find root package with this name; sub-packages found from parent

lookupReturnType

public IClass lookupReturnType()
return type of enclosing method, or void.class (wrapped) if in a constructor, or null if in a static or object initializer

lookupThrows

public IClass[] lookupThrows()
find checked exceptions caught in an enclosing try block or declared in throws clause of enclosing method or constructor

lookupThis

public Object lookupThis()
return "this", or null if not in non-static context (method, constructor, non-static initializer)

lookupEnclosingClass

public IClass lookupEnclosingClass()
return enclosing class, or null if not in a class.

lookupEnclosingPackage

public IPackage lookupEnclosingPackage()
return enclosing package

getOptionBits

public int getOptionBits()
get option bits; for options, see JevaES

getNext

public IEnv getNext()
next env frame; used by lookup methods

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-bugs@ai.mit.edu