subroutineattach_argumentsprivate
subroutine attach_arguments(list, id)
Connect the dummy arguments and result of a procedure with their declarations.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | inout | the entities | |
| id | integer | in | the procedure |
Calls
Source
Show the code
subroutine attach_arguments(list, id)
type(entity_list_t), intent(inout) :: list !! the entities
integer, intent(in) :: id !! the procedure
integer :: a, c, child, var
character(len=:), allocatable :: wanted
associate (p => list%box(id)%e)
if (p%kind == E_FUNCTION .and. p%result == 0) then
wanted = lowercase(p%more%result_name)
do c = 1, size(p%children)
child = p%children(c)
if (list%box(child)%e%kind /= E_VARIABLE) cycle
if (lowercase(list%box(child)%e%name) == wanted) then
p%result = child
list%box(child)%e%var_role = VAR_RESULT
exit
end if
end do
if (p%result == 0) p%result = implicit_variable(list, id, p%more%result_name, VAR_RESULT)
end if
call doxygen_params(list, id)
do a = 1, size(p%more%args)
wanted = lowercase(p%more%args(a)%s)
do c = 1, size(p%children)
child = p%children(c)
if (.not. allocated(list%box(child)%e%name)) cycle
if (list%box(child)%e%kind == E_VARIABLE) then
if (list%box(child)%e%var_role == VAR_PLAIN .and. lowercase(list%box(child)%e%name) == wanted) then
p%more%arg_ids(a) = child
list%box(child)%e%var_role = VAR_ARGUMENT
exit
end if
else if (list%box(child)%e%iface == IFACE_EXPLICIT .and. lowercase(list%box(child)%e%name) == wanted) then
p%more%arg_ids(a) = child
exit
end if
end do
if (p%more%arg_ids(a) == 0) then
var = implicit_variable(list, id, p%more%args(a)%s, VAR_ARGUMENT)
p%more%arg_ids(a) = var
end if
end do
end associate
end subroutine attach_arguments