fdoc

subroutinebind_targetsprivate

subroutine bind_targets(c, targets, v)

Bind the names of a loop to v in a comprehension.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

targetsintegerindimension(:)

the names

vtype(value_t)in

the value

Calls

Source

Show the code
subroutine bind_targets(c, targets, v)
    type(fypp_t), intent(inout) :: c        !! the state
    integer, intent(in) :: targets(:)       !! the names
    type(value_t), intent(in) :: v          !! the value
    integer :: k

    if (size(targets) == 1) then
        call bind_one(c, targets(1), v)
    else if (v%kind /= V_LIST .and. v%kind /= V_TUPLE) then
        call fail(c, 'a value cannot be unpacked')
    else if (size(v%items) /= size(targets)) then
        call fail(c, 'a value has the wrong number of items to unpack')
    else
        do k = 1, size(targets)
            call bind_one(c, targets(k), v%items(k))
        end do
    end if
end subroutine bind_targets

Graphs

Calls

Called by