functionlabel_itemprivate
integer function label_item(p, context, label) result(item)
The entity that label means in context, a scope or a type, or 0.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| p | type(project_t) | in | the project | |
| context | integer | in | the scope or type | |
| label | character(len=*) | in | the name, in lowercase |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| item | integer |
Calls
Source
Show the code
integer function label_item(p, context, label) result(item)
type(project_t), intent(in) :: p !! the project
integer, intent(in) :: context !! the scope or type
character(len=*), intent(in) :: label !! the name, in lowercase
integer :: base, k
item = 0
if (p%list%box(context)%e%kind == E_TYPE) then
item = type_member(p, context, label, E_VARIABLE)
if (item > 0) return
end if
! the arguments of a separate module procedure are those of its interface
associate (e => p%list%box(context)%e)
if (allocated(e%more%arg_ids)) then
do k = 1, size(e%more%arg_ids)
if (lowercase(p%list%box(e%more%arg_ids(k))%e%name) == label) then
item = e%more%arg_ids(k)
return
end if
end do
end if
if (e%result > 0) then
if (lowercase(p%list%box(e%result)%e%name) == label) then
item = e%result
return
end if
end if
end associate
item = find_symbol(p, context, label, 4)
if (item > 0) return
if (p%list%box(context)%e%kind == E_TYPE) then
base = p%list%box(context)%e%extends_id
do while (base > 0)
if (lowercase(p%list%box(base)%e%name) == label) then
item = base
return
end if
base = p%list%box(base)%e%extends_id
end do
end if
item = find_symbol(p, context, label, 3)
if (item > 0) return
if (p%list%box(context)%e%kind == E_TYPE) then
item = type_binding(p, context, label)
if (item > 0) return
end if
item = find_symbol(p, context, label, 1)
end function label_item