|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbsh.NameSpace
bsh.BlockNameSpace
A specialized namespace for Blocks (e.g. the body of a "for" statement). The Block acts like a child namespace but only for typed variables declared within it (block local scope) or untyped variables explicitly set in it via setBlockVariable(). Otherwise variable assignment (including untyped variable usage) acts like it is part of the containing block.
| Nested Class Summary |
| Nested classes inherited from class bsh.NameSource |
NameSource.Listener |
| Field Summary |
| Fields inherited from class bsh.NameSpace |
callerInfoNode, classInstance, classStatic, importedClasses, isClass, isMethod, JAVACODE, nameSourceListeners |
| Constructor Summary | |
BlockNameSpace(NameSpace parent)
|
|
| Method Summary | |
This |
getSuper(Interpreter declaringInterpreter)
super is our parent's super |
(package private) This |
getThis(Interpreter declaringInterpreter)
Get a 'this' reference is our parent's 'this' for the object closure. |
void |
importClass(java.lang.String name)
delegate import to our parent |
void |
importPackage(java.lang.String name)
delegate import to our parent |
void |
setBlockVariable(java.lang.String name,
java.lang.Object value)
Set an untyped variable in the block namespace. |
void |
setMethod(java.lang.String name,
BshMethod method)
Note: this is primarily for internal use. |
void |
setVariable(java.lang.String name,
java.lang.Object value,
boolean strictJava,
boolean recurse)
Override the standard namespace behavior to make assignments happen in our parent (enclosing) namespace, unless the variable has already been assigned here via a typed declaration or through the special setBlockVariable() (used for untyped args in try/catch). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public BlockNameSpace(NameSpace parent)
throws EvalError
| Method Detail |
public void setVariable(java.lang.String name,
java.lang.Object value,
boolean strictJava,
boolean recurse)
throws UtilEvalError
i.e. only allow typed var declaration to happen in this namespace. Typed vars are handled in the ordinary way local scope. All untyped assignments are delegated to the enclosing context.
setVariable in class NameSpacestrictJava - specifies whether strict java rules are applied.recurse - determines whether we will search for the variable in
our parent's scope before assigning locally.
UtilEvalError
Setting a new variable (which didn't exist before) or removing
a variable causes a namespace change.
public void setBlockVariable(java.lang.String name,
java.lang.Object value)
throws UtilEvalError
UtilEvalErrorThis getThis(Interpreter declaringInterpreter)
getThis in class NameSpace#getBlockThis( Interpreter )public This getSuper(Interpreter declaringInterpreter)
getSuper in class NameSpacepublic void importClass(java.lang.String name)
importClass in class NameSpacepublic void importPackage(java.lang.String name)
importPackage in class NameSpace
public void setMethod(java.lang.String name,
BshMethod method)
throws UtilEvalError
NameSpace
setMethod in class NameSpaceUtilEvalErrorInterpreter.source( String ),
Interpreter.eval( String )
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||