\section{KJS::Context Class Reference}
\label{classKJS_1_1Context}\index{KJS::Context@{KJS::Context}}
Represents an execution context, as specified by section 10 of the ECMA spec.  


{\tt \#include $<$interpreter.h$>$}

Collaboration diagram for KJS::Context:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=143pt]{classKJS_1_1Context__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Context} ({\bf Context\-Imp} $\ast$)\label{classKJS_1_1Context_a0}

\item 
{\bf Context} (const  {\bf Context} \&c)\label{classKJS_1_1Context_a1}

\item 
{\bf Context} \& {\bf operator=} (const  {\bf Context} \&c)\label{classKJS_1_1Context_a2}

\item 
bool {\bf is\-Null} () const \label{classKJS_1_1Context_a4}

\item 
{\bf Context\-Imp} $\ast$ {\bf imp} () const \label{classKJS_1_1Context_a5}

\item 
const  {\bf List} {\bf scope\-Chain} () const 
\begin{CompactList}\small\item\em Returns the scope chain for this execution context. \item\end{CompactList}\item 
{\bf Object} {\bf variable\-Object} () const 
\begin{CompactList}\small\item\em Returns the variable object for the execution context. \item\end{CompactList}\item 
{\bf Object} {\bf this\-Value} () const 
\begin{CompactList}\small\item\em Returns the \char`\"{}this\char`\"{} value for the execution context. \item\end{CompactList}\item 
const  {\bf Context} {\bf calling\-Context} () const 
\begin{CompactList}\small\item\em Returns the context from which the current context was invoked. \item\end{CompactList}\end{CompactItemize}


\subsection{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 \char`\"{}this\char`\"{}, etc. A new execution context is entered whenever global code is executed (e.g. with {\bf Interpreter::evaluate}{\rm (p.\,\pageref{classKJS_1_1Interpreter_a7})}()), a function is called (see {\bf Object::call}{\rm (p.\,\pageref{classKJS_1_1Object_a18})}()), or the builtin \char`\"{}eval\char`\"{} function is executed.

Most inheritable functions in the KJS api take a {\bf Exec\-State}{\rm (p.\,\pageref{classKJS_1_1ExecState})} pointer as their first parameter. This can be used to obtain a handle to the current execution context.

Note: {\bf Context}{\rm (p.\,\pageref{classKJS_1_1Context})} objects are wrapper classes/smart pointers for the internal KJS {\bf Context\-Imp}{\rm (p.\,\pageref{classKJS_1_1ContextImp})} 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.

\subsection{Member Function Documentation}
\index{KJS::Context@{KJS::Context}!scopeChain@{scopeChain}}
\index{scopeChain@{scopeChain}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf List} Context::scope\-Chain () const}\label{classKJS_1_1Context_a6}


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.

\begin{Desc}
\item[Returns:]The execution context's scope chain \end{Desc}


Definition at line 74 of file interpreter.cpp.

References KJS::Context\-Imp::scope\-Chain().\index{KJS::Context@{KJS::Context}!variableObject@{variableObject}}
\index{variableObject@{variableObject}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Object} Context::variable\-Object () const}\label{classKJS_1_1Context_a7}


Returns the variable object for the execution context. 

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

\begin{Desc}
\item[Returns:]The execution context's variable object \end{Desc}


Definition at line 79 of file interpreter.cpp.

References KJS::Context\-Imp::variable\-Object().\index{KJS::Context@{KJS::Context}!thisValue@{thisValue}}
\index{thisValue@{thisValue}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Object} Context::this\-Value () const}\label{classKJS_1_1Context_a8}


Returns the \char`\"{}this\char`\"{} value for the execution context. 

This is the value returned when a script references the special variable \char`\"{}this\char`\"{}. It should always be an {\bf Object}{\rm (p.\,\pageref{classKJS_1_1Object})}, unless application-specific code has passed in a different type.

The object that is used as the \char`\"{}this\char`\"{} 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 \char`\"{}this\char`\"{} value). For code executed by the built-in \char`\"{}eval\char`\"{} function, the this value is the same as the calling context.

\begin{Desc}
\item[Returns:]The execution context's \char`\"{}this\char`\"{} value \end{Desc}


Definition at line 84 of file interpreter.cpp.

References KJS::Context\-Imp::this\-Value().\index{KJS::Context@{KJS::Context}!callingContext@{callingContext}}
\index{callingContext@{callingContext}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf Context} Context::calling\-Context () const}\label{classKJS_1_1Context_a9}


Returns the context from which the current context was invoked. 

For global code this will be a null context (i.e. one for which is\-Null() returns true). You should check is\-Null() on the returned value before calling any of it's methods.

\begin{Desc}
\item[Returns:]The calling execution context \end{Desc}


Definition at line 89 of file interpreter.cpp.

References KJS::Context\-Imp::calling\-Context().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
interpreter.h\item 
interpreter.cpp\end{CompactItemize}
