koala.dynamicjava.interpreter.context
Class MethodContext
java.lang.Object
|
+--koala.dynamicjava.interpreter.context.VariableContext
|
+--koala.dynamicjava.interpreter.context.GlobalContext
|
+--koala.dynamicjava.interpreter.context.StaticContext
|
+--koala.dynamicjava.interpreter.context.MethodContext
- All Implemented Interfaces:
- Context, SimpleContext
- public class MethodContext
- extends StaticContext
A method method context.
Fields inherited from class koala.dynamicjava.interpreter.context.GlobalContext |
accessible, CLASS_TYPE, classCount, classLoader, clc, functions, importationManager, interpreter, LOCALS, LOCALS_NAME, MAP_TYPE, OBJECT_ARRAY_ARRAY, OBJECT_CLASS, OBJECT_TYPE |
Method Summary |
Expression |
createName(Node node,
IdentifierToken name)
Creates the tree that is associated with the given name |
Node |
getDefaultQualifier(Node node,
java.lang.String tname)
Returns the default qualifier for this context |
java.lang.Object |
getHiddenArgument()
Returns the default argument to pass to methods in this context |
protected java.lang.String |
getOuterThisName(java.lang.Class c)
Finds the name of the reference to an outerclass in the given class |
java.lang.Object |
invokeConstructor(ClassAllocation node,
java.lang.Object[] args)
Invokes a constructor |
java.lang.Object |
invokeConstructor(SimpleAllocation node,
java.lang.Object[] args)
Invokes a constructor |
protected boolean |
isInnerclass(java.lang.Class ic,
java.lang.Class oc)
Tests whether an class is an inner class of another |
java.lang.reflect.Method |
lookupMethod(Node prefix,
java.lang.String mname,
java.lang.Class[] params)
Looks for a method |
java.lang.Class |
setProperties(ClassAllocation node,
java.lang.Class c,
java.lang.Class[] args,
java.util.List memb)
Sets the properties of a ClassAllocation node |
java.lang.Class |
setProperties(SimpleAllocation node,
java.lang.Class c,
java.lang.Class[] cargs)
Sets the properties of a SimpleAllocation node |
Methods inherited from class koala.dynamicjava.interpreter.context.StaticContext |
classExists, defineClass, defineFunction, fieldExists, getDefaultQualifier, getField, getModifier, getSuperField, isDefined, isInnerClass, lookupClass, lookupSuperMethod, setAccessFlag |
Methods inherited from class koala.dynamicjava.interpreter.context.GlobalContext |
createClassArrayInitializer, declareClassImport, declarePackageImport, exists, getAccessible, getAdditionalClassLoader, getCurrentPackage, getFunctions, getImportationManager, getInterpreter, getModifier, getModifier, getModifier, getPackageName, lookupClass, lookupConstructor, lookupFunction, setAccessible, setAdditionalClassLoaderContainer, setCurrentPackage, setFunctions, setImportationManager |
Methods inherited from class koala.dynamicjava.interpreter.context.VariableContext |
define, defineConstant, defineVariables, enterScope, enterScope, get, getConstants, getCurrentScopeVariableNames, getCurrentScopeVariables, isDefinedVariable, isFinal, leaveScope, set, setConstant, setVariable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface koala.dynamicjava.interpreter.context.SimpleContext |
define, defineConstant, defineVariables, enterScope, enterScope, get, getConstants, getCurrentScopeVariableNames, getCurrentScopeVariables, isDefinedVariable, isFinal, leaveScope, set, setConstant, setVariable |
thisIdentifier
protected static final Identifier thisIdentifier
- The "this" identifier
MethodContext
public MethodContext(Interpreter i,
java.lang.Class c,
java.lang.Object obj,
ImportationManager im)
- Creates a new context
- Parameters:
i
- the interpreterc
- the declaring class of the methodobj
- the current objectim
- the importation manager
MethodContext
public MethodContext(Interpreter i,
java.lang.Class c,
java.lang.Object obj,
java.util.Set fp)
- Creates a new context
- Parameters:
i
- the interpreterc
- the declaring class of the methodobj
- the current objectfp
- the formal parameters
getDefaultQualifier
public Node getDefaultQualifier(Node node,
java.lang.String tname)
- Returns the default qualifier for this context
- Overrides:
getDefaultQualifier
in class GlobalContext
- Parameters:
s
- the qualifier of 'this'
createName
public Expression createName(Node node,
IdentifierToken name)
- Creates the tree that is associated with the given name
- Overrides:
createName
in class StaticContext
- Parameters:
node
- the current nodename
- the variable name- Throws:
java.lang.IllegalStateException
- if the variable is not defined
getHiddenArgument
public java.lang.Object getHiddenArgument()
- Returns the default argument to pass to methods in this context
- Overrides:
getHiddenArgument
in class GlobalContext
setProperties
public java.lang.Class setProperties(SimpleAllocation node,
java.lang.Class c,
java.lang.Class[] cargs)
- Sets the properties of a SimpleAllocation node
- Overrides:
setProperties
in class GlobalContext
- Parameters:
node
- the allocation nodec
- the class of the constructorcargs
- the classes of the arguments of the constructor
invokeConstructor
public java.lang.Object invokeConstructor(SimpleAllocation node,
java.lang.Object[] args)
- Invokes a constructor
- Overrides:
invokeConstructor
in class GlobalContext
- Parameters:
node
- the SimpleAllocation nodeargs
- the arguments
setProperties
public java.lang.Class setProperties(ClassAllocation node,
java.lang.Class c,
java.lang.Class[] args,
java.util.List memb)
- Sets the properties of a ClassAllocation node
- Overrides:
setProperties
in class StaticContext
- Parameters:
node
- the allocation nodec
- the class of the constructorargs
- the classes of the arguments of the constructormemb
- the class members
invokeConstructor
public java.lang.Object invokeConstructor(ClassAllocation node,
java.lang.Object[] args)
- Invokes a constructor
- Overrides:
invokeConstructor
in class GlobalContext
- Parameters:
node
- the ClassAllocation nodeargs
- the arguments
lookupMethod
public java.lang.reflect.Method lookupMethod(Node prefix,
java.lang.String mname,
java.lang.Class[] params)
throws java.lang.NoSuchMethodException
- Looks for a method
- Overrides:
lookupMethod
in class StaticContext
- Parameters:
prefix
- the method prefixmname
- the method nameparams
- the parameter types- Throws:
java.lang.NoSuchMethodException
- if the method cannot be found
isInnerclass
protected boolean isInnerclass(java.lang.Class ic,
java.lang.Class oc)
- Tests whether an class is an inner class of another
- Parameters:
ic
- the possibly inner classoc
- the possibly outer class
getOuterThisName
protected java.lang.String getOuterThisName(java.lang.Class c)
- Finds the name of the reference to an outerclass in the given class
Copyright © 2001 Stephane Hillion. All Rights Reserved.