@@ -33,28 +33,19 @@ bash_object.traverse-set() {
33
33
local key=" ${REPLIES[$i]} "
34
34
filter_stack+=(" $key " )
35
35
36
+ local oldIFS=" $IFS "
37
+ IFS=' _'
38
+ local filter_stack_string=" ${filter_stack[*]} "
39
+ IFS=" $oldIFS "
40
+
36
41
bash_object.trace_loop
37
42
38
43
# If 'key' is not a member of object or index of array, error
39
44
if [ -z " ${current_object["$key"]+x} " ]; then
40
45
# If we are before the last element in the query, then error
41
46
if (( i+ 1 < ${# REPLIES[@]} )) ; then
42
- echo " could not traverse property does not exist"
43
- return 2
44
- # # The variable is 'new_current_object_name', but it also could
45
- # # be the name of a new _array_
46
- # local new_current_object_name="__bash_object_${root_object_name}_tree_${key}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}"
47
-
48
- # if ! eval "declare -gA $new_current_object_name=()"; then
49
- # printf '%s\n' 'Error: bash-object: eval declare failed'
50
- # return 1
51
- # fi
52
-
53
- # current_object["$key"]=$'\x1C\x1D'"type=object;&$new_current_object_name"
54
-
55
- # current_object_name="$new_current_object_name"
56
- # # shellcheck disable=SC2178
57
- # local -n current_object="$new_current_object_name"
47
+ bash_object.util.die ' ERROR_VALUE_NOT_FOUND' " Key or index '$key ' is not in '$filter_stack_string '"
48
+ return
58
49
# If we are at the last element in the query
59
50
elif (( i+ 1 == ${# REPLIES[@]} )) ; then
60
51
if [ " $final_value_type " = object ]; then
@@ -63,11 +54,6 @@ bash_object.traverse-set() {
63
54
return
64
55
fi
65
56
66
- local oldIFS=" $IFS "
67
- IFS=' _'
68
- local filter_stack_string=" ${filter_stack[*]} "
69
- IFS=" $oldIFS "
70
-
71
57
bash_object.util.generate_vobject_name " $root_object_name " " $filter_stack_string "
72
58
local global_object_name=" $REPLY "
73
59
@@ -101,11 +87,6 @@ bash_object.traverse-set() {
101
87
return
102
88
fi
103
89
104
- local oldIFS=" $IFS "
105
- IFS=' _'
106
- local filter_stack_string=" ${filter_stack[*]} "
107
- IFS=" $oldIFS "
108
-
109
90
bash_object.util.generate_vobject_name " $root_object_name " " $filter_stack_string "
110
91
local global_array_name=" $REPLY "
111
92
0 commit comments