Added function to cleanup expanded after looping

This commit is contained in:
Joseph Dalrymple 2023-04-03 02:22:05 -05:00
parent 5603ad4178
commit 766f3f0371

16
mo
View File

@ -497,6 +497,20 @@ moExpandAssoc() {
done
}
# Internal: Cleans the values from a previous expanded assoc
#
# $1 - Array name
#
# Returns nothing.
moCleanExpanded() {
local moKeys moValue moValueArr
moKeys=($(eval 'echo "${!'$1'[@]}"'))
for k in "${moKeys[@]}"; do
unset -v "$k"
done
}
# Internal: Scans a string to determine if all elements are declared arrays
#
# $1-@ - Array elements
@ -818,6 +832,8 @@ moParse() {
moCurContext=$(moAppendContext "$moContext" "$k" "$moValue")
moParse "${moBlock[0]}" "$moFullKey" false "$moCurContext"
moCleanExpanded "$moValue"
done;
else
moParse "${moBlock[0]}" "$moCurrent" true "$moContext"