subroutinelink_variableprivate
subroutine link_variable(p, id)
Find the type or interface that a variable declaration names.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| p | type(project_t) | inout | the project | |
| id | integer | in | the variable |
Calls
Source
Show the code
subroutine link_variable(p, id)
type(project_t), intent(inout) :: p !! the project
integer, intent(in) :: id !! the variable
character(len=:), allocatable :: name
associate (v => p%list%box(id)%e)
if (.not. allocated(v%proto)) return
name = lowercase(v%proto(1)%s)
if (name == '*') return
if (v%vartype == 'procedure') then
v%proto_id = find_symbol(p, v%parent, name, 1)
if (v%proto_id == 0) v%proto_id = find_symbol(p, v%parent, name, 2)
else
v%proto_id = find_symbol(p, v%parent, name, 3)
end if
end associate
end subroutine link_variable