• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KJS

KJS::Context

KJS::Context Class Reference

#include <context.h>

List of all members.


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]

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 65 of file context.h.

JSObject* KJS::Context::variableObject (  )  const [inline]

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 73 of file context.h.

void KJS::Context::setVariableObject ( JSObject *  v  )  [inline]

Definition at line 74 of file context.h.

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

Definition at line 91 of file context.h.

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

Definition at line 101 of file context.h.

ActivationImp* KJS::Context::activationObject (  )  [inline]

Definition at line 103 of file context.h.

CodeType KJS::Context::codeType (  )  [inline]

Definition at line 108 of file context.h.

FunctionBodyNode* KJS::Context::currentBody (  )  [inline]

Definition at line 109 of file context.h.

FunctionImp* KJS::Context::function (  )  const [inline]

Definition at line 110 of file context.h.

const List* KJS::Context::arguments (  )  const [inline]

Definition at line 111 of file context.h.

void KJS::Context::pushScope ( JSObject *  s  )  [inline]

Definition at line 113 of file context.h.

void KJS::Context::popScope (  )  [inline]

Definition at line 114 of file context.h.

void KJS::Context::mark (  ) 

Definition at line 95 of file Context.cpp.


The documentation for this class was generated from the following files:
  • context.h
  • Context.cpp

KJS

Skip menu "KJS"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   WTF
  • KJSEmbed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  •   core
  • Phonon
  •   Backend
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal