|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.dynamicjava.interpreter.DelegatingContext
public abstract class DelegatingContext
An abstract context that delegates to an enclosing context by default.
Constructor Summary | |
---|---|
protected |
DelegatingContext(TypeContext next)
|
Method Summary | |
---|---|
Access.Module |
accessModule()
Get the current access module. |
protected abstract TypeContext |
duplicate(TypeContext next)
Create a copy of this context with the given context enclosing it. |
boolean |
fieldExists(String name,
TypeSystem ts)
Test whether name is an in-scope field |
boolean |
functionExists(String name,
TypeSystem ts)
Test whether name is an in-scope method or local function |
ClassLoader |
getClassLoader()
Return the class loader for the current scope. |
Iterable<Type> |
getDeclaredThrownTypes()
The types that are allowed to be thrown in the current context. |
Iterable<LocalFunction> |
getLocalFunctions(String name,
TypeSystem ts)
List all local functions that match the given name (empty if there are none). |
Iterable<LocalFunction> |
getLocalFunctions(String name,
TypeSystem ts,
Iterable<LocalFunction> partial)
Helper for getLocalFunctions: list all matching functions, including those provided. |
LocalVariable |
getLocalVariable(String name,
TypeSystem ts)
Return the variable object for the given name, or null if it does not exist. |
Type |
getReturnType()
The expected type of a return statement in the given context, or null
if return statements should not appear here. |
DJClass |
getThis()
Return the class of this in the current context, or null
if there is no such value (for example, in a static context). |
DJClass |
getThis(String className)
Return the class of className.this in the current context, or null
if there is no such value (for example, in a static context). |
DJClass |
getThis(Type expected,
TypeSystem ts)
Return the innermost "this" class with the given type in the current context, or null if there is no such value (for example, in a static context). |
DJClass |
getTopLevelClass(String name,
TypeSystem ts)
Return the top-level class with the given name, or null if it does not exist. |
VariableType |
getTypeVariable(String name,
TypeSystem ts)
Return the type variable with the given name, or null if it does not exist. |
TypeContext |
importField(DJClass c,
String name)
Import the field(s) of c with the given name |
TypeContext |
importMemberClass(DJClass outer,
String name)
Import the member class(es) of outer with the given name |
TypeContext |
importMemberClasses(DJClass outer)
Import on demand all member classes of the given class |
TypeContext |
importMethod(DJClass c,
String name)
Import the method(s) of c with the given name |
TypeContext |
importStaticMembers(DJClass c)
Import on demand all static members of the given class |
TypeContext |
importTopLevelClass(DJClass c)
Import the given top-level class |
TypeContext |
importTopLevelClasses(String pkg)
Import on demand all top-level classes in the given package |
DJClass |
initializingClass()
Class which is being initialized (via a constructor or initialization block); null otherwise. |
boolean |
localFunctionExists(String name,
TypeSystem ts)
Test whether name is an in-scope local function |
boolean |
localVariableExists(String name,
TypeSystem ts)
Test whether name is an in-scope local variable |
String |
makeAnonymousClassName()
Return a full name for an anonymous class declared here. |
String |
makeClassName(String n)
Return a full name for a class with the given name declared here. |
boolean |
memberClassExists(String name,
TypeSystem ts)
Test whether name is an in-scope member class |
boolean |
methodExists(String name,
TypeSystem ts)
Test whether name is an in-scope method |
TypeContext |
setPackage(String name)
Set the current package to the given package name |
boolean |
topLevelClassExists(String name,
TypeSystem ts)
Test whether name is an in-scope top-level class |
ClassType |
typeContainingField(String name,
TypeSystem ts)
Return the most inner type containing a field with the given name, or null
if there is no such type. |
ClassType |
typeContainingMemberClass(String name,
TypeSystem ts)
Return the most inner type containing a class with the given name, or null
if there is no such type. |
Type |
typeContainingMethod(String name,
TypeSystem ts)
Return the most inner type containing a method with the given name, or null
if there is no such type. |
boolean |
typeExists(String name,
TypeSystem ts)
Test whether name is an in-scope top-level class, member class, or type variable |
boolean |
typeVariableExists(String name,
TypeSystem ts)
Test whether name is an in-scope type variable. |
boolean |
variableExists(String name,
TypeSystem ts)
Test whether name is an in-scope field or local variable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DelegatingContext(TypeContext next)
Method Detail |
---|
protected abstract TypeContext duplicate(TypeContext next)
public TypeContext setPackage(String name)
setPackage
in interface TypeContext
public TypeContext importTopLevelClasses(String pkg)
importTopLevelClasses
in interface TypeContext
public TypeContext importMemberClasses(DJClass outer)
importMemberClasses
in interface TypeContext
public TypeContext importStaticMembers(DJClass c)
importStaticMembers
in interface TypeContext
public TypeContext importTopLevelClass(DJClass c)
importTopLevelClass
in interface TypeContext
public TypeContext importMemberClass(DJClass outer, String name)
outer
with the given name
importMemberClass
in interface TypeContext
public TypeContext importField(DJClass c, String name)
c
with the given name
importField
in interface TypeContext
public TypeContext importMethod(DJClass c, String name)
c
with the given name
importMethod
in interface TypeContext
public boolean typeExists(String name, TypeSystem ts)
name
is an in-scope top-level class, member class, or type variable
typeExists
in interface TypeContext
public boolean topLevelClassExists(String name, TypeSystem ts)
name
is an in-scope top-level class
topLevelClassExists
in interface TypeContext
public DJClass getTopLevelClass(String name, TypeSystem ts) throws AmbiguousNameException
null
if it does not exist.
getTopLevelClass
in interface TypeContext
AmbiguousNameException
public boolean memberClassExists(String name, TypeSystem ts)
name
is an in-scope member class
memberClassExists
in interface TypeContext
public ClassType typeContainingMemberClass(String name, TypeSystem ts) throws AmbiguousNameException
null
if there is no such type.
typeContainingMemberClass
in interface TypeContext
AmbiguousNameException
public boolean typeVariableExists(String name, TypeSystem ts)
name
is an in-scope type variable.
typeVariableExists
in interface TypeContext
public VariableType getTypeVariable(String name, TypeSystem ts)
null
if it does not exist.
getTypeVariable
in interface TypeContext
public boolean variableExists(String name, TypeSystem ts)
name
is an in-scope field or local variable
variableExists
in interface TypeContext
public boolean fieldExists(String name, TypeSystem ts)
name
is an in-scope field
fieldExists
in interface TypeContext
public ClassType typeContainingField(String name, TypeSystem ts) throws AmbiguousNameException
null
if there is no such type.
typeContainingField
in interface TypeContext
AmbiguousNameException
public boolean localVariableExists(String name, TypeSystem ts)
name
is an in-scope local variable
localVariableExists
in interface TypeContext
public LocalVariable getLocalVariable(String name, TypeSystem ts)
null
if it does not exist.
getLocalVariable
in interface TypeContext
public boolean functionExists(String name, TypeSystem ts)
name
is an in-scope method or local function
functionExists
in interface TypeContext
public boolean methodExists(String name, TypeSystem ts)
name
is an in-scope method
methodExists
in interface TypeContext
public Type typeContainingMethod(String name, TypeSystem ts)
null
if there is no such type.
typeContainingMethod
in interface TypeContext
public boolean localFunctionExists(String name, TypeSystem ts)
name
is an in-scope local function
localFunctionExists
in interface TypeContext
public final Iterable<LocalFunction> getLocalFunctions(String name, TypeSystem ts)
getLocalFunctions(String, TypeSystem, Iterable)
.
getLocalFunctions
in interface TypeContext
public Iterable<LocalFunction> getLocalFunctions(String name, TypeSystem ts, Iterable<LocalFunction> partial)
TypeContext
getLocalFunctions
in interface TypeContext
public Access.Module accessModule()
TypeContext
accessModule
in interface TypeContext
public String makeClassName(String n)
makeClassName
in interface TypeContext
public String makeAnonymousClassName()
makeAnonymousClassName
in interface TypeContext
public DJClass getThis()
this
in the current context, or null
if there is no such value (for example, in a static context).
getThis
in interface TypeContext
public DJClass getThis(String className)
className.this
in the current context, or null
if there is no such value (for example, in a static context).
getThis
in interface TypeContext
public DJClass getThis(Type expected, TypeSystem ts)
TypeContext
null
if there is no such value (for example, in a static context).
getThis
in interface TypeContext
public DJClass initializingClass()
TypeContext
null
otherwise.
initializingClass
in interface TypeContext
public Type getReturnType()
return
statement in the given context, or null
if return
statements should not appear here.
getReturnType
in interface TypeContext
public Iterable<Type> getDeclaredThrownTypes()
getDeclaredThrownTypes
in interface TypeContext
public ClassLoader getClassLoader()
TypeContext
getClassLoader
in interface TypeContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |