|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.dynamicjava.interpreter.DelegatingContext
edu.rice.cs.dynamicjava.interpreter.ImportContext
public class ImportContext
The context at the top level of a source file or local block. Manages package and import statements.
| Constructor Summary | |
|---|---|
ImportContext(java.lang.ClassLoader loader,
Options opt)
Make a top-level context that delegates to a LibraryContext based on the given class loader. |
|
ImportContext(TypeContext next,
Options opt)
Make a top-level context that delegates to the given context. |
|
| Method Summary | |
|---|---|
Access.Module |
accessModule()
Get the current access module. |
protected TypeContext |
duplicate(TypeContext next)
Create a copy of this context with the given context enclosing it. |
boolean |
fieldExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope field |
boolean |
functionExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope method or local function |
java.lang.Iterable<Type> |
getDeclaredThrownTypes()
The types that are allowed to be thrown in the current context. |
java.lang.Iterable<LocalFunction> |
getLocalFunctions(java.lang.String name,
TypeSystem ts,
java.lang.Iterable<LocalFunction> partial)
Helper for getLocalFunctions: list all matching functions, including those provided. |
LocalVariable |
getLocalVariable(java.lang.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 type of this in the current context, or null
if there is no such value (for example, in a static context). |
DJClass |
getThis(java.lang.String className)
Return the type 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(java.lang.String name,
TypeSystem ts)
Return the top-level class with the given name, or null if it does not exist. |
TypeContext |
importField(DJClass c,
java.lang.String name)
Import the field(s) of c with the given name |
TypeContext |
importMemberClass(DJClass outer,
java.lang.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,
java.lang.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(java.lang.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(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope local function |
boolean |
localVariableExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope local variable |
java.lang.String |
makeAnonymousClassName()
Return a full name for an anonymous class declared here. |
java.lang.String |
makeClassName(java.lang.String n)
Return a full name for a class with the given name declared here. |
boolean |
memberClassExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope member class |
boolean |
methodExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope method |
TypeContext |
setPackage(java.lang.String name)
Set the current package to the given package name |
boolean |
topLevelClassExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope top-level class |
ClassType |
typeContainingField(java.lang.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(java.lang.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(java.lang.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(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope top-level class, member class, or type variable |
boolean |
variableExists(java.lang.String name,
TypeSystem ts)
Test whether name is an in-scope field or local variable |
| Methods inherited from class edu.rice.cs.dynamicjava.interpreter.DelegatingContext |
|---|
getClassLoader, getLocalFunctions, getTypeVariable, typeVariableExists |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImportContext(java.lang.ClassLoader loader,
Options opt)
public ImportContext(TypeContext next,
Options opt)
| Method Detail |
|---|
protected TypeContext duplicate(TypeContext next)
DelegatingContext
duplicate in class DelegatingContextpublic TypeContext setPackage(java.lang.String name)
setPackage in interface TypeContextsetPackage in class DelegatingContextpublic TypeContext importTopLevelClasses(java.lang.String pkg)
importTopLevelClasses in interface TypeContextimportTopLevelClasses in class DelegatingContextpublic TypeContext importMemberClasses(DJClass outer)
importMemberClasses in interface TypeContextimportMemberClasses in class DelegatingContextpublic TypeContext importStaticMembers(DJClass c)
importStaticMembers in interface TypeContextimportStaticMembers in class DelegatingContextpublic TypeContext importTopLevelClass(DJClass c)
importTopLevelClass in interface TypeContextimportTopLevelClass in class DelegatingContext
public TypeContext importMemberClass(DJClass outer,
java.lang.String name)
outer with the given name
importMemberClass in interface TypeContextimportMemberClass in class DelegatingContext
public TypeContext importField(DJClass c,
java.lang.String name)
c with the given name
importField in interface TypeContextimportField in class DelegatingContext
public TypeContext importMethod(DJClass c,
java.lang.String name)
c with the given name
importMethod in interface TypeContextimportMethod in class DelegatingContext
public boolean typeExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope top-level class, member class, or type variable
typeExists in interface TypeContexttypeExists in class DelegatingContext
public boolean topLevelClassExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope top-level class
topLevelClassExists in interface TypeContexttopLevelClassExists in class DelegatingContext
public DJClass getTopLevelClass(java.lang.String name,
TypeSystem ts)
throws AmbiguousNameException
DelegatingContextnull if it does not exist.
getTopLevelClass in interface TypeContextgetTopLevelClass in class DelegatingContextAmbiguousNameException
public boolean memberClassExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope member class
memberClassExists in interface TypeContextmemberClassExists in class DelegatingContext
public ClassType typeContainingMemberClass(java.lang.String name,
TypeSystem ts)
throws AmbiguousNameException
DelegatingContextnull
if there is no such type.
typeContainingMemberClass in interface TypeContexttypeContainingMemberClass in class DelegatingContextAmbiguousNameException
public boolean variableExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope field or local variable
variableExists in interface TypeContextvariableExists in class DelegatingContext
public boolean fieldExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope field
fieldExists in interface TypeContextfieldExists in class DelegatingContext
public ClassType typeContainingField(java.lang.String name,
TypeSystem ts)
throws AmbiguousNameException
DelegatingContextnull
if there is no such type.
typeContainingField in interface TypeContexttypeContainingField in class DelegatingContextAmbiguousNameException
public boolean localVariableExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope local variable
localVariableExists in interface TypeContextlocalVariableExists in class DelegatingContext
public LocalVariable getLocalVariable(java.lang.String name,
TypeSystem ts)
DelegatingContextnull if it does not exist.
getLocalVariable in interface TypeContextgetLocalVariable in class DelegatingContext
public boolean functionExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope method or local function
functionExists in interface TypeContextfunctionExists in class DelegatingContext
public boolean methodExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope method
methodExists in interface TypeContextmethodExists in class DelegatingContext
public Type typeContainingMethod(java.lang.String name,
TypeSystem ts)
DelegatingContextnull
if there is no such type.
typeContainingMethod in interface TypeContexttypeContainingMethod in class DelegatingContext
public boolean localFunctionExists(java.lang.String name,
TypeSystem ts)
DelegatingContextname is an in-scope local function
localFunctionExists in interface TypeContextlocalFunctionExists in class DelegatingContext
public java.lang.Iterable<LocalFunction> getLocalFunctions(java.lang.String name,
TypeSystem ts,
java.lang.Iterable<LocalFunction> partial)
TypeContext
getLocalFunctions in interface TypeContextgetLocalFunctions in class DelegatingContextpublic Access.Module accessModule()
TypeContext
accessModule in interface TypeContextaccessModule in class DelegatingContextpublic java.lang.String makeClassName(java.lang.String n)
makeClassName in interface TypeContextmakeClassName in class DelegatingContextpublic java.lang.String makeAnonymousClassName()
makeAnonymousClassName in interface TypeContextmakeAnonymousClassName in class DelegatingContextpublic DJClass getThis()
this in the current context, or null
if there is no such value (for example, in a static context).
getThis in interface TypeContextgetThis in class DelegatingContextpublic DJClass getThis(java.lang.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 TypeContextgetThis in class DelegatingContext
public DJClass getThis(Type expected,
TypeSystem ts)
TypeContextnull if there is no such value (for example, in a static context).
getThis in interface TypeContextgetThis in class DelegatingContextpublic DJClass initializingClass()
TypeContextnull otherwise.
initializingClass in interface TypeContextinitializingClass in class DelegatingContextpublic Type getReturnType()
return statement in the given context, or null
if return statements should not appear here.
getReturnType in interface TypeContextgetReturnType in class DelegatingContextpublic java.lang.Iterable<Type> getDeclaredThrownTypes()
getDeclaredThrownTypes in interface TypeContextgetDeclaredThrownTypes in class DelegatingContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||