functionnearest_callerpureprivate
pure integer function nearest_caller(list, stack, top) result(caller)
The innermost entity on stack that can call procedures, or 0 if there is none or a declaration
scope such as a type is inside it.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | in | the entities | |
| stack | integer | in | dimension(0:top) | the open constructs |
| top | integer | in | the top of the stack |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| caller | integer |
Source
Show the code
pure integer function nearest_caller(list, stack, top) result(caller)
type(entity_list_t), intent(in) :: list !! the entities
integer, intent(in) :: top !! the top of the stack
integer, intent(in) :: stack(0:top) !! the open constructs
integer :: k
caller = 0
do k = top, 0, -1
if (stack(k) == 0) cycle
select case (list%box(stack(k))%e%kind)
case (E_SUBROUTINE, E_FUNCTION, E_MODPROC, E_PROGRAM)
caller = stack(k)
end select
return
end do
end function nearest_caller