diff options
Diffstat (limited to 'bos-mop.sh')
-rw-r--r-- | bos-mop.sh | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -23,6 +23,12 @@ function bos/mop/base/find-method-into() { local mro_store; $self mro-for-into "$class" mro_store local -n mro="$mro_store" + + # minimal MRO: the class itself + if [[ "${#mro[@]}" -eq 0 ]]; then + mro=( "$class" ) + fi + local idx=0 # if we don't have a $start_from_class, it means we're doing the @@ -67,14 +73,18 @@ function bos/mop/base/invoke() { fi # get the first class that defines the method - local to_invoke - $self find-method-into "$class" "$start_from_class" "$method" to_invoke + + # there is some fuckery going on with namerefs, recursion, and + # local; this is a probably-bad-but-works workaround: use a + # different variable name in different recursive calls + local ffsname="to_invoke_${#FUNCNAME[*]}" + $self find-method-into "$class" "$start_from_class" "$method" "$ffsname" # TODO: make the fields accessible! - local self bos-object-id/pack-self-into "$class" "$object_id" self # call it - "$to_invoke" "$@" + eval "\"\$$ffsname\" \"\$@\"" + return $? } |