summaryrefslogtreecommitdiff
path: root/bos-mop-inheritance.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bos-mop-inheritance.sh')
-rw-r--r--bos-mop-inheritance.sh51
1 files changed, 0 insertions, 51 deletions
diff --git a/bos-mop-inheritance.sh b/bos-mop-inheritance.sh
deleted file mode 100644
index cc3d604..0000000
--- a/bos-mop-inheritance.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!bash
-
-# this encoding must match bos-namespaces/encode-into
-bos_5fbos_2fmop_2finheritance_5fmeta="bos-dispatch/invoke bos/mop/base 0"
-declare -a bos_5fbos_2fmop_2finheritance_5fmro=( "bos/mop/inheritance" "bos/mop/base" )
-
-function bos/mop/inheritance/isa-for-into() {
- bos-namespaces/store-array-for-into "$1" isa "$2"
-}
-
-function bos/mop/inheritance/set-superclasses-for() {
- local isa_name; $self isa-for-into isa_name "$1"
- local -n isa="$isa_name"
- shift
-
- isa=( "$@" )
-
- return 0
-}
-
-function bos/mop/inheritance/get-superclasses-for-into() {
- local -n dest="$1"
- local isa_name; $self isa-for-into isa_name "$2"
- local -n isa="$isa_name"
-
- dest=( "${isa[@]}" )
-
- return 0
-}
-
-# given a class and an array, sets the array to the list of clasess to
-# look into when resolving a method call for the given class, in order
-function bos/mop/inheritance/make-mro-for() {
- local class="$1"
- local mro_name; $self mro-for-into mro_name "$class"
- local -n mro="$mro_name"
-
- # TODO: use C3 and support multiple inheritance
-
- mro=( "$class" )
- local -a nextclasses
- $self get-superclasses-for-into nextclasses "$class"
-
- while [[ "${#nextclasses}" -gt 0 ]]; do
- mro+=( "${nextclasses[0]}" )
- class="${nextclasses[0]}"
- $self get-superclasses-for-into nextclasses "$class"
- done
-
- return 0
-}