fdoc

subroutineadd_callprivate

subroutine add_call(v, j, e, associations)

Add the reference ending at name j to e%more%calls, unless it is intrinsic or already there.

Arguments

NameTypeIntentAttributesDescription
vtype(statement_view_t)in

the statement

jintegerin

the last name

etype(entity_t)inout

the entity it is in

associationstype(association_t)indimension(:)

the names in scope

Calls

Source

Show the code
subroutine add_call(v, j, e, associations)
    type(statement_view_t), intent(in) :: v     !! the statement
    integer, intent(in) :: j                    !! the last name
    type(entity_t), intent(inout) :: e          !! the entity it is in
    type(association_t), intent(in) :: associations(:)  !! the names in scope
    character(len=:), allocatable :: chain
    integer :: k, depth, a, first
    logical :: start

    if (is_intrinsic(v%low(v%lo(j):v%hi(j)))) return
    if (.not. allocated(e%more%calls)) allocate (e%more%calls(0))
    do k = 1, size(e%more%calls)
        if (ends_with(e%more%calls(k)%s, v%low(v%lo(j):v%hi(j)))) then
            if (e%more%calls(k)%s == v%low(v%lo(j):v%hi(j))) return
            a = len(e%more%calls(k)%s) - (v%hi(j) - v%lo(j) + 1)
            if (e%more%calls(k)%s(a:a) == '%') return
        end if
    end do

    first = chain_start(v, j)
    chain = ''
    start = .true.
    depth = v%depth(first)
    do k = first, j
        if (v%depth(k) /= depth .or. v%kind_of(k) /= TK_NAME) cycle
        if (start) then
            start = .false.
            chain = v%low(v%lo(k):v%hi(k))
            do a = size(associations), 1, -1
                if (associations(a)%name == chain) then
                    chain = associations(a)%chain
                    exit
                end if
            end do
        else
            chain = chain//'%'//v%low(v%lo(k):v%hi(k))
        end if
    end do
    call push(e%more%calls, chain)
end subroutine add_call

Graphs

Calls

Called by