From cc99c87c988b5f91fdd433b11beeaec91318d4cc Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Fri, 14 Jul 2023 12:21:21 +0100 Subject: fix find-method-into `${#foo}` is the character length of the first element of `foo` (because `$foo` is that first element), `${#foo[@]}` is the number of elements --- bos-mop.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bos-mop.sh') diff --git a/bos-mop.sh b/bos-mop.sh index e18baec..7cd28c7 100644 --- a/bos-mop.sh +++ b/bos-mop.sh @@ -27,7 +27,7 @@ function bos/mop/base/find-method-into() { # if we don't have a $start_from_class, it means we're doing the # initial method resolution, so don't skip any class in $mro if [[ -n "$start_from_class" ]]; then - for (( ; idx <= "${#mro}" ; ++idx )); do + for (( ; idx < "${#mro[@]}" ; ++idx )); do if [[ "${mro[$idx]}" == "$start_from_class" ]]; then (( ++idx )) break @@ -35,7 +35,7 @@ function bos/mop/base/find-method-into() { done fi - for (( ; idx <= "${#mro}" ; ++idx )); do + for (( ; idx < "${#mro[@]}" ; ++idx )); do local full_name="${mro[$idx]}/${method}" if declare -F "$full_name" >/dev/null; then result="${full_name}" -- cgit v1.2.3