KJS
KJS::Context Class Reference
#include <context.h>
Detailed Description
Execution context.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.
Definition at line 51 of file context.h.
Public Member Functions | |
| Context (JSObject *global, Interpreter *, JSObject *thisV, FunctionBodyNode *currentBody, CodeType type=GlobalCode, Context *callingContext=0, FunctionImp *function=0, const List *args=0) | |
| ~Context () | |
| const ScopeChain & | scopeChain () const |
| JSObject * | variableObject () const |
| void | setVariableObject (JSObject *v) |
| JSObject * | thisValue () const |
| Context * | callingContext () |
| ActivationImp * | activationObject () |
| CodeType | codeType () |
| FunctionBodyNode * | currentBody () |
| FunctionImp * | function () const |
| const List * | arguments () const |
| void | pushScope (JSObject *s) |
| void | popScope () |
| void | mark () |
Constructor & Destructor Documentation
| KJS::Context::Context | ( | JSObject * | global, | |
| Interpreter * | interpreter, | |||
| JSObject * | thisV, | |||
| FunctionBodyNode * | currentBody, | |||
| CodeType | type = GlobalCode, |
|||
| Context * | callingContext = 0, |
|||
| FunctionImp * | function = 0, |
|||
| const List * | args = 0 | |||
| ) |
Definition at line 32 of file Context.cpp.
| KJS::Context::~Context | ( | ) |
Definition at line 83 of file Context.cpp.
Member Function Documentation
| const ScopeChain& KJS::Context::scopeChain | ( | ) | const [inline] |
| JSObject* KJS::Context::variableObject | ( | ) | const [inline] |
| void KJS::Context::setVariableObject | ( | JSObject * | v | ) | [inline] |
| JSObject* KJS::Context::thisValue | ( | ) | const [inline] |
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
| Context* KJS::Context::callingContext | ( | ) | [inline] |
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
| ActivationImp* KJS::Context::activationObject | ( | ) | [inline] |
| FunctionBodyNode* KJS::Context::currentBody | ( | ) | [inline] |
| FunctionImp* KJS::Context::function | ( | ) | const [inline] |
| void KJS::Context::mark | ( | ) |
Definition at line 95 of file Context.cpp.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference