• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kjs
 

kjs

  • KJS
  • Context
Public Member Functions | List of all members
KJS::Context Class Reference

#include <interpreter.h>

Public Member Functions

 Context (ContextImp *i)
 
ContextImp * imp () const
 
const ScopeChain & scopeChain () const
 
Object variableObject () const
 
Object thisValue () const
 
const Context callingContext () const
 
CodeType codeType () const
 
int sourceId () const
 
int curStmtFirstLine () const
 
int curStmtLastLine () const
 
Object function () const
 
Identifier functionName () const
 
List args () 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.

Definition at line 72 of file interpreter.h.

Constructor & Destructor Documentation

◆ Context()

KJS::Context::Context ( ContextImp *  i)
inline

Definition at line 74 of file interpreter.h.

Member Function Documentation

◆ args()

List Context::args ( ) const

In the case of FunctionCode, the arguments passed to the function.

Definition at line 95 of file interpreter.cpp.

◆ callingContext()

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 60 of file interpreter.cpp.

◆ codeType()

CodeType Context::codeType ( ) const

The type of code being executed in this context.

One of GlobalCode, EvalCode or FunctionCode

Definition at line 65 of file interpreter.cpp.

◆ curStmtFirstLine()

int Context::curStmtFirstLine ( ) const

The line number on which the current statement begins.

Definition at line 75 of file interpreter.cpp.

◆ curStmtLastLine()

int Context::curStmtLastLine ( ) const

The line number on which the current statement ends.

Definition at line 80 of file interpreter.cpp.

◆ function()

Object Context::function ( ) const

In the case of FunctionCode, the function objects being called.

Definition at line 85 of file interpreter.cpp.

◆ functionName()

Identifier Context::functionName ( ) const

In the case of FunctionCode, the name of the function being called.

Definition at line 90 of file interpreter.cpp.

◆ imp()

ContextImp * KJS::Context::imp ( ) const
inline

Definition at line 76 of file interpreter.h.

◆ scopeChain()

const ScopeChain & 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 45 of file interpreter.cpp.

◆ sourceId()

int Context::sourceId ( ) const

The identifier of the source code fragment containing the code being executed.

Definition at line 70 of file interpreter.cpp.

◆ thisValue()

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 55 of file interpreter.cpp.

◆ variableObject()

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 50 of file interpreter.cpp.


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

kjs

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

kjs

Skip menu "kjs"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kjs by doxygen 1.9.4
This website is maintained by Timothy Pearson.