CXXR (C++ R)
Public Member Functions | Static Public Member Functions
CXXR::ClosureContext Class Reference

Context typically recording the call of a Closure. More...

#include <ClosureContext.hpp>

Inheritance diagram for CXXR::ClosureContext:
Inheritance graph
[legend]
Collaboration diagram for CXXR::ClosureContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ClosureContext (const Expression *the_call, Environment *call_env, const FunctionBase *function, Environment *working_env, const PairList *promise_args)
 Constructor.
RObjecthandlerStack () const
 (Not for general use.)
RObjectonExit () const
 on.exit code.
const PairListpromiseArgs () const
 Call arguments wrapped in Promises.
void setOnExit (RObject *onexit)
 Designate an on.exit object.
EnvironmentworkingEnvironment () const
 Working environment of the Context's Closure.
- Public Member Functions inherited from CXXR::FunctionContext
 FunctionContext (const Expression *the_call, Environment *call_env, const FunctionBase *function)
 Constructor.
const Expressioncall () const
 The call of the Context.
EnvironmentcallEnvironment () const
 The call Environment.
const FunctionBasefunction () const
 Function being applied.
RObjectsourceLocation () const
 Source location associated with this Context.
- Public Member Functions inherited from CXXR::Evaluator::Context
ContextnextOut () const
 Next Context out.
Type type () const
 Type of the Context.

Static Public Member Functions

static ClosureContextinnermost (Evaluator::Context *start=Evaluator::Context::innermost())
 Search outwards for a ClosureContext.

Detailed Description

Context typically recording the call of a Closure.

The normal use of a ClosureContext is to record the application of a Closure.

However, ClosureContext objects are also created by do_eval(), DispatchOrEval() and tryDispatch() (all in eval.cpp), and in such cases the function parameter to the constructor may be null, or point to a BuiltInFunction rather than a Closure, and the arguments listed by the promise_args parameter may not actually be wrapped in Promise objects.

Todo:
Regularize aberrant (i.e. non-Closure-related) uses of ClosureContext.

Constructor & Destructor Documentation

ClosureContext::ClosureContext ( const Expression the_call,
Environment call_env,
const FunctionBase function,
Environment working_env,
const PairList promise_args 
)

Constructor.

Parameters:
the_callPointer to the call with which this Context is associated.
call_envPointer to the Environment in which the_call is to be evaluated.
functionPointer to the FunctionBase being applied. Normally this will be a Closure.
working_envPointer to the working environment of the Closure, i.e. the environment in which assignments create bindings, and in which default values of parameters are evaluated.
promise_argsPointer, possibly null, to the list of arguments to the call, each wrapped in a Promise.

Member Function Documentation

RObject* CXXR::ClosureContext::handlerStack ( ) const
inline

(Not for general use.)

This function will be removed in future refactorization.

Returns:
Pointer to the handler stack associated with this Context.
ClosureContext * ClosureContext::innermost ( Evaluator::Context start = Evaluator::Context::innermost())
static

Search outwards for a ClosureContext.

This function works outwards from the Evaluator::Context start until it finds a ClosureContext (possibly start itself), and returns a pointer to that ClosureContext.

Parameters:
startThe Evaluator::Context from which the search is to start.
Returns:
Pointer to the innermost ClosureContext found, or a null pointer if no such context was found.

Reimplemented from CXXR::FunctionContext.

RObject* CXXR::ClosureContext::onExit ( ) const
inline

on.exit code.

Returns:
Pointer, possibly null, to an RObject to be evaluated on exit from the Context, whether by normal exit or by propagation of a C++ exception.
const PairList* CXXR::ClosureContext::promiseArgs ( ) const
inline

Call arguments wrapped in Promises.

Returns:
pointer, possibly null, to the list of arguments to the call, each wrapped in a Promise.
void CXXR::ClosureContext::setOnExit ( RObject onexit)
inline

Designate an on.exit object.

Parameters:
onexitPointer, possibly null, to an RObject to be evaluated on exit from the Context, whether by normal exit or by propagation of a C++ exception.
Environment* CXXR::ClosureContext::workingEnvironment ( ) const
inline

Working environment of the Context's Closure.

Returns:
Pointer to the working environment of this Context's Closure, i.e. the environment in which assignments create bindings, and in which default values of parameters are evaluated.

The documentation for this class was generated from the following files: