oscript.data
Class GlobalScope

java.lang.Object
  extended by oscript.data.Value
      extended by oscript.data.Scope
          extended by oscript.data.BasicScope
              extended by oscript.data.GlobalScope
All Implemented Interfaces:
java.io.Serializable

public class GlobalScope
extends BasicScope

Each interpreter instance has a single global scope, which serves to terminate the scope chain.

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Field Summary
static Value TYPE
           
 
Fields inherited from class oscript.data.BasicScope
members, mixins, smit
 
Fields inherited from class oscript.data.Scope
previous
 
Fields inherited from class oscript.data.Value
DEBUG, MEMBER_NAMES, NULL, PARENT_TYPE_NAME, TYPE_NAME, UNDEFINED
 
Constructor Summary
GlobalScope()
          Class Constructor.
 
Method Summary
 Scope getSafeCopy()
          In case a scope has any resource allocated from a source which will no long be valid after a stack frame has returned (ie.
 Value getSuper()
          Lookup the "super" within a scope.
 Value getThis()
          Lookup the "this" within a scope.
 Value getThis(Value val)
          Lookup the qualified "this" within a scope.
protected  Value getTypeImpl()
          Get the type of this object.
 Value lookupInScope(int id)
          Get a member from this scope.
 
Methods inherited from class oscript.data.BasicScope
__getInstanceMember, createMember, free, getInstanceMemberImpl, getMember, getMemberImpl, getType, isSafe, mixin, populateMemberSet, reset
 
Methods inherited from class oscript.data.Scope
__setJavaObject, createMember, createMember, findDesc, getCallee, getPreviousScope, lookupInScope, lookupInScope
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, bopBitwiseAnd, bopBitwiseAndR, bopBitwiseOr, bopBitwiseOrR, bopBitwiseXor, bopBitwiseXorR, bopCast, bopCastR, bopDivide, bopDivideR, bopEquals, bopEqualsR, bopGreaterThan, bopGreaterThanOrEquals, bopGreaterThanOrEqualsR, bopGreaterThanR, bopInstanceOf, bopInstanceOfR, bopLeftShift, bopLeftShiftR, bopLessThan, bopLessThanOrEquals, bopLessThanOrEqualsR, bopLessThanR, bopLogicalAnd, bopLogicalAndR, bopLogicalOr, bopLogicalOrR, bopMinus, bopMinusR, bopMultiply, bopMultiplyR, bopNotEquals, bopNotEqualsR, bopPlus, bopPlusR, bopRemainder, bopRemainderR, bopSignedRightShift, bopSignedRightShiftR, bopUnsignedRightShift, bopUnsignedRightShiftR, callAsConstructor, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsExtends, callAsFunction, callAsFunction, callAsFunction, castToBoolean, castToExactNumber, castToInexactNumber, castToJavaObject, castToString, elementAt, elementsAt, getMember, getMember, getMember, getMember, getMember, getMonitor, getTypeMember, getTypeMember, isA, length, memberSet, noSuchMember, opAssign, populateTypeMemberSet, readExternal, toString, unhand, uopBitwiseNot, uopDecrement, uopIncrement, uopLogicalNot, uopMinus, uopPlus, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final Value TYPE
Constructor Detail

GlobalScope

public GlobalScope()
Class Constructor.

Method Detail

getTypeImpl

protected Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by BasicScope.getType().

Overrides:
getTypeImpl in class BasicScope
Returns:
the object's type

getSafeCopy

public Scope getSafeCopy()
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.

Overrides:
getSafeCopy in class BasicScope

getSuper

public Value getSuper()
Lookup the "super" within a scope. Within a function body, "super" is the overriden function (if there is one).

Overrides:
getSuper in class Scope
Returns:
the "this" ScriptObject within this scope

getThis

public Value getThis()
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.

Overrides:
getThis in class Scope
Returns:
the "this" ScriptObject within this scope

getThis

public Value getThis(Value val)
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.

Overrides:
getThis in class Scope
Parameters:
val - the type that the "this" qualifies
Returns:
the qualified "this" ScriptObject within this scope

lookupInScope

public Value lookupInScope(int id)
                    throws PackagedScriptObjectException
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.

Overrides:
lookupInScope in class BasicScope
Parameters:
id - the id of the symbol that maps to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException