| java.lang.Object oscript.data.Value oscript.data.Scope
All known Subclasses: oscript.data.BasicScope, oscript.data.ForkScope,
Scope | abstract public class Scope extends Value (Code) | | Scope is an internal object use to represent a scope of execution. It is
used to implement nested scope, ie. if a lookup in this scope fails, the
lookup will procedue in the previous scope, and so on.
author: Rob Clark (rob@ti.com) |
Field Summary | |
protected Scope | previous Previous in object scope chain. |
Constructor Summary | |
protected | Scope(Scope previous) Class Constructor. |
previous | protected Scope previous(Code) | | Previous in object scope chain. This is used to lookupInScope ,
when the member being looked-up doesn't exist in this object (ie scope
chain node)
|
Scope | protected Scope(Scope previous)(Code) | | Class Constructor. Construct a element in the scope chain. This
constructs a "function" element in the scope chain. This is
called from the Function class when a function is evaluateded.
Parameters: previous - previous in environment scope chain |
__getInstanceMember | abstract public Value __getInstanceMember(int id)(Code) | | |
__setJavaObject | public void __setJavaObject(Object javaObject)(Code) | | Set the java-object associated with a script object... this is used
when a script type subclasses a java type.
Parameters: javaObject - the java-object |
createMember | final public Value createMember(String name, int attr)(Code) | | Create a member of this object with the specified value. This method
is provided for convenience.
Parameters: name - the name of the member Parameters: attr - the attributes of the object (see Reference .) See Also: Reference |
createMember | final public Value createMember(Value name, int attr)(Code) | | Create a member of this object with the specified value.
Parameters: name - the name of the member Parameters: attr - the attributes of the object (see Reference .) See Also: Reference |
createMember | abstract public Value createMember(int id, int attr)(Code) | | Create a member of this object with the specified value.
Parameters: id - the id of the symbol that maps to the member Parameters: attr - the attributes of the object (see Reference .) See Also: Reference |
free | abstract public void free()(Code) | | Indicate that this scope is no longer needed. This should only be called
in cases of scopes allocated from the stack.
|
getCallee | public Value getCallee()(Code) | | Lookup the "callee" within a scope. The "callee" is the first scope
chain node that is a function-scope, rather than a regular scope chain
node.
the "callee" Function within callee scope |
getInstanceMemberImpl | protected Value getInstanceMemberImpl(int id)(Code) | | |
getMemberImpl | protected Value getMemberImpl(int id)(Code) | | |
getPreviousScope | public Scope getPreviousScope()(Code) | | Get the previous scope in the scope chain.
the parent scope, or null if this is the global-scope (ie. topmost scope in the scope chain) |
getSafeCopy | public Scope getSafeCopy()(Code) | | In case a scope has any resource allocated from a source which will
no long be valid after a stack frame has returned (ie. resource
allocated from stack), return a copy of the scope that is safe to
keep after the stack frame returns.
|
getSuper | public Value getSuper()(Code) | | Lookup the "super" within a scope. Within a function body, "super"
is the overriden function (if there is one).
the "this" ScriptObject within this scope |
getThis | public Value getThis()(Code) | | Lookup the "this" within a scope. The "this" is the first scope chain
node that is an object, rather than a regular scope chain node.
the "this" ScriptObject within this scope |
getThis | public Value getThis(Value val)(Code) | | Lookup the qualified "this" within a scope. The qualified "this" is
the first scope chain node that is an object and an instance of the
specified type, rather than a regular scope chain node.
Parameters: val - the type that the "this" qualifies the qualified "this" ScriptObject within this scope |
isSafe | abstract public boolean isSafe()(Code) | | |
lookupInScope | final public Value lookupInScope(String name) throws PackagedScriptObjectException(Code) | | Get a member from this scope. This is used to access local variables
and object attributes from methods of the object. If the attribute
isn't in this node in the scope chain, then the previous
node in the scope chain is checked. This method is provided for
convenience.
Parameters: name - the name of the member throws: PackagedScriptObjectException - (NoSuchMemberException) |
lookupInScope | final public Value lookupInScope(Value name) throws PackagedScriptObjectException(Code) | | Get a member from this scope. This is used to access local variables
and object attributes from methods of the object. If the attribute
isn't in this node in the scope chain, then the previous
node in the scope chain is checked.
Parameters: name - the name of the member throws: PackagedScriptObjectException - (NoSuchMemberException) |
lookupInScope | abstract public Value lookupInScope(int id) throws PackagedScriptObjectException(Code) | | Get a member from this scope. This is used to access local variables
and object attributes from methods of the object. If the attribute
isn't in this node in the scope chain, then the previous
node in the scope chain is checked.
Parameters: id - the id of the symbol that maps to the member throws: PackagedScriptObjectException - (NoSuchMemberException) |
mixin | abstract public void mixin(Value val)(Code) | | "mixin" the specified variable into the current scope. When a object
is mixed in, all of it's members are mixed in to the current scope.
Members created within this scope will take precedence over a member
of a mixed in object. The following script code example gives an idea
of how this works:
mixin java.lang.Math; // defines "min", "max", etc
var c = min( a, b );
var d = max( a, b );
Mixins can also be used to implement OO composition, so a constructor
function can mixin members of another object. (Note that this will
not make the resulting object an instanceof this mixed in object's
type... this could be made to work at some point in the future for
script code, but not for java code, if that was deemed a good thing..)
function ListAndStuff()
{
public function foo() { ... }
var list = new java.util.LinkedList();
mixin list;
}
var obj = new ListAndStuff();
obj.foo();
obj.add(1);
obj.add("two");
for( var o : obj )
writeln("list member: " + o);
Parameters: val - the value to mixin to this scope |
Methods inherited from oscript.data.Value | public static Value _getTypeMember(Value type, Value obj, int id)(Code)(Java Doc) public static void _populateTypeMemberSet(Value type, java.util.Set s, boolean d)(Code)(Java Doc) public Value bopBitwiseAnd(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseAndR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseOr(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseOrR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseXor(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseXorR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopCast(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopCastR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopDivide(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopDivideR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThan(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanOrEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanOrEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopInstanceOf(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopInstanceOfR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLeftShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLeftShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThan(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanOrEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanOrEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalAnd(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalAndR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalOr(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalOrR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMinus(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMinusR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMultiply(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMultiplyR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopNotEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopNotEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopPlus(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopPlusR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopRemainder(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopRemainderR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopSignedRightShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopSignedRightShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopUnsignedRightShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopUnsignedRightShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value callAsConstructor(StackFrame sf, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsConstructor(Value[] args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsConstructor(StackFrame sf, Value[] args)(Code)(Java Doc) public Value callAsExtends(StackFrame sf, Scope scope, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsExtends(Scope scope, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsExtends(StackFrame sf, Scope scope, Value[] args)(Code)(Java Doc) public Value callAsFunction(StackFrame sf, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsFunction(Value[] args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsFunction(StackFrame sf, Value[] args)(Code)(Java Doc) public boolean castToBoolean() throws PackagedScriptObjectException(Code)(Java Doc) public long castToExactNumber() throws PackagedScriptObjectException(Code)(Java Doc) public double castToInexactNumber() throws PackagedScriptObjectException(Code)(Java Doc) public Object castToJavaObject() throws PackagedScriptObjectException(Code)(Java Doc) public String castToString() throws PackagedScriptObjectException(Code)(Java Doc) public Value elementAt(Value idx) throws PackagedScriptObjectException(Code)(Java Doc) public Value elementsAt(Value idx1, Value idx2) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(String name) throws PackagedScriptObjectException(Code)(Java Doc) public Value getMember(Value name) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(int id) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(String name, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(Value name, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) public Value getMember(int id, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) public Object getMonitor()(Code)(Java Doc) public Value getType()(Code)(Java Doc) abstract protected Value getTypeImpl()(Code)(Java Doc) protected Value getTypeMember(Value obj, int id)(Code)(Java Doc) final protected Value getTypeMember(Value obj, Value name)(Code)(Java Doc) public boolean isA(Value type)(Code)(Java Doc) public int length() throws PackagedScriptObjectException(Code)(Java Doc) public java.util.Set memberSet()(Code)(Java Doc) protected PackagedScriptObjectException noSuchMember(String member)(Code)(Java Doc) public void opAssign(Value val) throws PackagedScriptObjectException(Code)(Java Doc) protected void populateMemberSet(java.util.Set s, boolean debugger)(Code)(Java Doc) protected void populateTypeMemberSet(java.util.Set s, boolean debugger)(Code)(Java Doc) public void readExternal(java.io.ObjectInput in) throws ClassNotFoundException, java.io.IOException(Code)(Java Doc) public String toString()(Code)(Java Doc) public Value unhand()(Code)(Java Doc) public Value uopBitwiseNot() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopDecrement() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopIncrement() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopLogicalNot() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopMinus() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopPlus() throws PackagedScriptObjectException(Code)(Java Doc) public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException(Code)(Java Doc)
|
|
|