\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=318pt]{classKJS_1_1Context__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Context} ({\bf Context\-Imp} $\ast$i)\label{classKJS_1_1Context_a0}

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

\item 
const {\bf Scope\-Chain} \& {\bf scope\-Chain} () const 
\item 
{\bf Object} {\bf variable\-Object} () const 
\item 
{\bf Object} {\bf this\-Value} () const 
\item 
const {\bf Context} {\bf calling\-Context} () const 
\item 
Code\-Type {\bf code\-Type} () const 
\item 
int {\bf source\-Id} () const 
\item 
int {\bf cur\-Stmt\-First\-Line} () const 
\item 
int {\bf cur\-Stmt\-Last\-Line} () const 
\item 
{\bf Object} {\bf function} () const 
\item 
{\bf Identifier} {\bf function\-Name} () const 
\item 
{\bf List} {\bf args} () const 
\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_a8})}), a function is called (see {\bf Object::call()}{\rm (p.\,\pageref{classKJS_1_1Object_a20})}), 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 73 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 Scope\-Chain} \& Context::scope\-Chain () const}\label{classKJS_1_1Context_a2}


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 46 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_a3}


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 51 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_a4}


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 56 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_a5}


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

References KJS::Context\-Imp::calling\-Context().\index{KJS::Context@{KJS::Context}!codeType@{codeType}}
\index{codeType@{codeType}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Code\-Type Context::code\-Type () const}\label{classKJS_1_1Context_a6}


The type of code being executed in this context. 

One of Global\-Code, Eval\-Code or Function\-Code 

Definition at line 66 of file interpreter.cpp.

References KJS::Context\-Imp::code\-Type.\index{KJS::Context@{KJS::Context}!sourceId@{sourceId}}
\index{sourceId@{sourceId}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Context::source\-Id () const}\label{classKJS_1_1Context_a7}


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



Definition at line 71 of file interpreter.cpp.

References KJS::Context\-Imp::source\-Id.\index{KJS::Context@{KJS::Context}!curStmtFirstLine@{curStmtFirstLine}}
\index{curStmtFirstLine@{curStmtFirstLine}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Context::cur\-Stmt\-First\-Line () const}\label{classKJS_1_1Context_a8}


The line number on which the current statement begins. 



Definition at line 76 of file interpreter.cpp.

References KJS::Context\-Imp::line0.\index{KJS::Context@{KJS::Context}!curStmtLastLine@{curStmtLastLine}}
\index{curStmtLastLine@{curStmtLastLine}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Context::cur\-Stmt\-Last\-Line () const}\label{classKJS_1_1Context_a9}


The line number on which the current statement ends. 



Definition at line 81 of file interpreter.cpp.

References KJS::Context\-Imp::line1.\index{KJS::Context@{KJS::Context}!function@{function}}
\index{function@{function}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Object} Context::function () const}\label{classKJS_1_1Context_a10}


In the case of Function\-Code, the function objects being called. 



Definition at line 86 of file interpreter.cpp.

References KJS::Context\-Imp::function().\index{KJS::Context@{KJS::Context}!functionName@{functionName}}
\index{functionName@{functionName}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Identifier} Context::function\-Name () const}\label{classKJS_1_1Context_a11}


In the case of Function\-Code, the name of the function being called. 



Definition at line 91 of file interpreter.cpp.

References KJS::Context\-Imp::function\-Name.\index{KJS::Context@{KJS::Context}!args@{args}}
\index{args@{args}!KJS::Context@{KJS::Context}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf List} Context::args () const}\label{classKJS_1_1Context_a12}


In the case of Function\-Code, the arguments passed to the function. 



Definition at line 96 of file interpreter.cpp.

References KJS::Context\-Imp::args.

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