fdoc

subroutinelink_usesprivate

subroutine link_uses(p)

Find the modules that use statements and submodules refer to.

Arguments

NameTypeIntentAttributesDescription
ptype(project_t)inout

the project

Calls

Source

Show the code
subroutine link_uses(p)
    type(project_t), intent(inout) :: p     !! the project
    integer :: k, u, j, found

    do k = 1, p%list%n
        associate (e => p%list%box(k)%e)
            if (allocated(e%more%uses)) then
                do u = 1, size(e%more%uses)
                    found = find_module(p, e%more%uses(u)%module)
                    if (found > 0) e%more%uses(u)%target = p%modules(found)
                    call read_use_spec(e%more%uses(u)%spec, e%more%uses(u)%only, e%more%uses(u)%renames)
                end do
            end if
            if (e%kind /= E_SUBMODULE) cycle
            found = find_module(p, e%more%ancestor)
            if (found > 0) e%ancestor_id = p%modules(found)
            if (allocated(e%more%parent_submodule)) then
                do j = 1, size(p%submodules)
                    if (lowercase(p%list%box(p%submodules(j))%e%name) == e%more%parent_submodule) then
                        e%parent_submodule_id = p%submodules(j)
                    end if
                end do
            end if
        end associate
    end do
end subroutine link_uses

Graphs

Calls

Called by