fdoc

functiontype_memberprivate

integer function type_member(p, id, name, kind) result(found)

The component of kind kind named name of type id, including inherited ones, or 0.

Arguments

NameTypeIntentAttributesDescription
ptype(project_t)in

the project

idintegerin

the type

namecharacter(len=*)in

the name, in lowercase

kindintegerin

one of the E_* constants

Result

NameTypeAttributesDescription
foundinteger

Source

Show the code
integer function type_member(p, id, name, kind) result(found)
    type(project_t), intent(in) :: p        !! the project
    integer, intent(in) :: id               !! the type
    character(len=*), intent(in) :: name    !! the name, in lowercase
    integer, intent(in) :: kind             !! one of the `E_*` constants
    integer :: k

    found = 0
    associate (e => p%list%box(id)%e)
        ! a generic binding can be declared in several statements: the last counts
        do k = size(e%children), 1, -1
            if (p%list%box(e%children(k))%e%kind /= kind) cycle
            if (lowercase(p%list%box(e%children(k))%e%name) == name) then
                found = e%children(k)
                return
            end if
        end do
        if (.not. allocated(e%more%inherited)) return
        do k = 1, size(e%more%inherited)
            if (p%list%box(e%more%inherited(k))%e%kind /= kind) cycle
            if (lowercase(p%list%box(e%more%inherited(k))%e%name) == name) then
                found = e%more%inherited(k)
                return
            end if
        end do
    end associate
end function type_member

Graphs

Called by