Skip to content

Commit cfda2c5

Browse files
committed
fix: Remove extraneous quotations in object access
1 parent 65d49e6 commit cfda2c5

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

docs/getting-started-technical.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ local -n current_object="$current_object_name"
7979
declare -gA REPLY=()
8080
local key=
8181
for key in "${!current_object[@]}"; do
82-
REPLY["$key"]="${current_object["$key"]}"
82+
REPLY["$key"]="${current_object[$key]}"
8383
done
8484
```
8585

pkg/lib/traverse-get.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ bash_object.traverse-get() {
9191
bash_object.trace_loop
9292

9393
# If 'key' is not a member of object or index of array, error
94-
if [ -z "${current_object["$key"]+x}" ]; then
94+
if [ -z "${current_object[$key]+x}" ]; then
9595
bash_object.util.die 'ERROR_NOT_FOUND' "Key or index '$key' (querytree index '$i') does not exist"
9696
return
9797
# If 'key' is a member of an object or index of array
9898
else
99-
local key_value="${current_object["$key"]}"
99+
local key_value="${current_object[$key]}"
100100

101101
# If 'key_value' is a virtual object, dereference it
102102
if [ "${key_value::2}" = $'\x1C\x1D' ]; then
@@ -165,7 +165,7 @@ bash_object.traverse-get() {
165165
declare -gA REPLY=()
166166
local key=
167167
for key in "${!current_object[@]}"; do
168-
REPLY["$key"]="${current_object["$key"]}"
168+
REPLY["$key"]="${current_object[$key]}"
169169
done
170170
elif [ "$flag_as_what" = 'as-ref' ]; then
171171
bash_object.util.die 'ERROR_INTERNAL' "--ref not implemented"
@@ -238,7 +238,7 @@ bash_object.traverse-get() {
238238
bash_object.util.die 'ERROR_NOT_FOUND' "The passed querytree implies that '$key' accesses an object or array, but a string with a value of '$key_value' was found instead"
239239
return
240240
elif ((i+1 == ${#REPLIES[@]})); then
241-
local value="${current_object["$key"]}"
241+
local value="${current_object[$key]}"
242242
if [ "$final_value_type" = object ]; then
243243
bash_object.util.die 'ERROR_ARGUMENTS_INCORRECT_TYPE' "Queried for $final_value_type, but found existing string '$value'"
244244
return

pkg/lib/traverse-set.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ bash_object.traverse-set() {
207207
bash_object.trace_loop
208208

209209
# If 'key' is not a member of object or index of array, error
210-
if [ -z "${current_object["$key"]+x}" ]; then
210+
if [ -z "${current_object[$key]+x}" ]; then
211211
# If we are before the last element in the query, then error
212212
if ((i+1 < ${#REPLIES[@]})); then
213213
bash_object.util.die 'ERROR_NOT_FOUND' "Key or index '$key' (querytree index '$i') does not exist"
@@ -235,7 +235,7 @@ bash_object.traverse-set() {
235235

236236
for key in "${!object_to_copy_from[@]}"; do
237237
# shellcheck disable=SC2034
238-
global_object["$key"]="${object_to_copy_from["$key"]}"
238+
global_object["$key"]="${object_to_copy_from[$key]}"
239239
done
240240
elif [ "$final_value_type" = array ]; then
241241
bash_object.util.generate_vobject_name "$root_object_name" "$querytree_stack_string"
@@ -267,7 +267,7 @@ bash_object.traverse-set() {
267267
fi
268268
# If 'key' is already a member of object or index of array
269269
else
270-
local key_value="${current_object["$key"]}"
270+
local key_value="${current_object[$key]}"
271271

272272
# If 'key_value' is a virtual object, dereference it
273273
if [ "${key_value::2}" = $'\x1C\x1D' ]; then
@@ -383,7 +383,7 @@ bash_object.traverse-set() {
383383
bash_object.util.die 'ERROR_NOT_FOUND' "The passed querytree implies that '$key' accesses an object or array, but a string with a value of '$key_value' was found instead"
384384
return
385385
elif ((i+1 == ${#REPLIES[@]})); then
386-
local value="${current_object["$key"]}"
386+
local value="${current_object[$key]}"
387387
if [ "$final_value_type" = object ]; then
388388
bash_object.util.die 'ERROR_ARGUMENTS_INCORRECT_TYPE' "Assigning an $final_value_type, but found existing string '$value'"
389389
return

pkg/lib/util/trace.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bash_object.trace_loop() {
99
stdtrace.log 0 "current_object_name: '$current_object_name'"
1010
stdtrace.log 0 "current_object=("
1111
for debug_key in "${!current_object[@]}"; do
12-
stdtrace.log 0 " [$debug_key]='${current_object["$debug_key"]}'"
12+
stdtrace.log 0 " [$debug_key]='${current_object[$debug_key]}'"
1313
done
1414
stdtrace.log 0 ")"
1515
fi
@@ -21,7 +21,7 @@ bash_object.trace_current_object() {
2121
stdtrace.log 0 "current_object_name: '$current_object_name'"
2222
stdtrace.log 0 "current_object=("
2323
for debug_key in "${!current_object[@]}"; do
24-
stdtrace.log 0 " [$debug_key]='${current_object["$debug_key"]}'"
24+
stdtrace.log 0 " [$debug_key]='${current_object[$debug_key]}'"
2525
done
2626
stdtrace.log 0 ")"
2727
fi

0 commit comments

Comments
 (0)