Function CallerNode(Depth)

CallerNode

The function CallerNode returns the node that is on the current execution stack.

CallerNode(
     Depth      ! (optional) scalar element parameter
     )

Arguments

Depth

An numeric optional expression with default 1. The value should be in the range \(\{ 1 \ldots\) CallerNumberOfLocations \(\}\). The value 1, refers to the caller of the currently running procedure.

Return Value

This function returns an element in AllSymbols.

Example

The function CallerNode is usually part of utility code, as follows:

1Procedure pr_fragmentCallerNode {
2    Body: {
3        _ep_callerNode := CallerNode(1);
4        display _ep_callerNode ;
5    }
6    ElementParameter _ep_callerNode {
7        Range: AllSymbols;
8    }
9}

Which can then be used as follows:

Procedure pr_testCallerNode {
    Body: {
        ! Hello

        pr_fragmentCallerNode();
    }
    aimmsunit::TestSuite: modelQuery;
}

A call to pr_testCallerNode produces in the listing file:

_ep_callerNode := 'chapterModel::sectionModelQuery::funcCallerNode::pr_testCallerNode' ;

For a more extended illustration of how the function CallerNode can be part of utility code, please check the example at CallerNumberOfLocations.

References