class Context

# class Context | Represents an execution context, as specified by section 10 of the ECMA spec. More...
Full name | `KJS::Context`
Definition | `#include <interpreter.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- Context (ContextImp *)
- Context (const Context &c)
- Context& operator= (const Context &c)
- virtual ~Context ()
- bool isNull () const
- ContextImp * imp () const
- const List scopeChain () const
- Object variableObject () const
- Object thisValue () const
- const Context callingContext () const

## Detailed Description

Represents an execution context, as specified by section 10 of the ECMA spec.

An execution context contains information about the current state of the script - the scope for variable lookup, the value of "this", etc. A new execution context is entered whenever global code is executed (e.g. with Interpreter::evaluate()), a function is called (see Object::call()), or the builtin "eval" function is executed.

Most inheritable functions in the KJS api take a ExecState pointer as their first parameter. This can be used to obtain a handle to the current execution context.

Note: Context objects are wrapper classes/smart pointers for the internal KJS ContextImp type. When one context variable is assigned to another, it is still referencing the same internal object.

Context (ContextImp *) | ### Context

Context (const Context &c) | ### Context

Context& operator= (const Context &c) | ### operator=

~Context () | ### ~Context

[virtual]

bool isNull () | ### isNull

[const]

ContextImp * imp () | ### imp

[const]

const List scopeChain () | ### scopeChain

[const]

Returns the scope chain for this execution context. This is used for variable lookup, with the list being searched from start to end until a variable is found.

Returns: The execution context's scope chain

Object variableObject () | ### variableObject

[const]

Returns the variable object for the execution context. This contains a property for each variable declared in the execution context.

Returns: The execution context's variable object

Object thisValue () | ### thisValue

[const]

Returns the "this" value for the execution context. This is the value returned when a script references the special variable "this". It should always be an Object, unless application-specific code has passed in a different type.

The object that is used as the "this" value depends on the type of execution context - for global contexts, the global object is used. For function objewcts, the value is given by the caller (e.g. in the case of obj.func(), obj would be the "this" value). For code executed by the built-in "eval" function, the this value is the same as the calling context.

Returns: The execution context's "this" value

const Context callingContext () | ### callingContext

[const]

Returns the context from which the current context was invoked. For global code this will be a null context (i.e. one for which isNull() returns true). You should check isNull() on the returned value before calling any of it's methods.

Returns: The calling execution context

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:37:28 2003, using kdoc 2.0a54.