diff --git a/core/state.py b/core/state.py index 0ce4d7c4d..69e6e9448 100644 --- a/core/state.py +++ b/core/state.py @@ -660,7 +660,8 @@ def _DumpVarFrame(frame): if case(value_e.Undef): cell_json['val'] = value.Null - elif case(value_e.Str, value_e.BashArray, value_e.BashAssoc): + elif case(value_e.Str, value_e.BashArray, value_e.BashAssoc, + value_e.SparseArray): cell_json['val'] = cell.val else: diff --git a/spec/ble-idioms.test.sh b/spec/ble-idioms.test.sh index 5c06074f1..95bae8767 100644 --- a/spec/ble-idioms.test.sh +++ b/spec/ble-idioms.test.sh @@ -1145,3 +1145,27 @@ true ## N-I bash/zsh/mksh/ash STDOUT: ## END + + +#### SparseArray: crash dump +case $SH in bash|zsh|mksh|ash) exit ;; esac + +OILS_CRASH_DUMP_DIR=$TMP $SH -ec 'a=({0..3}); unset -v "a[2]"; var a = _a2sp(a); false' +json read (&crash_dump) < $TMP/*.json +json write (crash_dump.var_stack[0].a) + +## STDOUT: +{ + "val": { + "type": "SparseArray", + "data": { + "0": "0", + "1": "1", + "3": "3" + } + } +} +## END + +## N-I bash/zsh/mksh/ash STDOUT: +## END