| # kjs Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KJS::Context Class Reference

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

`#include <interpreter.h>`

Collaboration diagram for KJS::Context:

[legend]
List of all members.

## Public Member Functions
| Context (ContextImp *)
| Context (const Context &c)
Context & | operator= (const Context &c)
bool | isNull () const
ContextImp * | imp () const
const List | scopeChain () const
| Returns the scope chain for this execution context.
Object | variableObject () const
| Returns the variable object for the execution context.
Object | thisValue () const
| Returns the "this" value for the execution context.
const Context | callingContext () const
| Returns the context from which the current context was invoked.

## 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.

Definition at line 56 of file interpreter.h.

## Member Function Documentation

const List Context::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 Definition at line 74 of file interpreter.cpp. References KJS::ContextImp::scopeChain().

Object Context::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 Definition at line 79 of file interpreter.cpp. References KJS::ContextImp::variableObject().

Object Context::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 Definition at line 84 of file interpreter.cpp. References KJS::ContextImp::thisValue().

const Context Context::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 Definition at line 89 of file interpreter.cpp. References KJS::ContextImp::callingContext().

The documentation for this class was generated from the following files:

- interpreter.h
- interpreter.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:08:56 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001