From 0b7de99925c579847318ac79c0e4c5edf95e13ce Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 24 May 2021 20:39:40 +0900 Subject: [PATCH] global: improve the workaround of bash-4.2 `declare -gA` by separate assignments --- ble-decode.sh | 5 +++-- ble-syntax-lazy.sh | 8 ++++---- lib/core-syntax.sh | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ble-decode.sh b/ble-decode.sh index 746c3ed1..304be8ba 100644 --- a/ble-decode.sh +++ b/ble-decode.sh @@ -49,12 +49,13 @@ ble_decode_MaskFlag=0x7FC00000 ble_decode_IsolatedESC=$((0x07FF)) -if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then +if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then _ble_decode_kbd_ver=4 _ble_decode_kbd__n=0 builtin unset -v _ble_decode_kbd__k2c - if ((_ble_bash>=40300)); then + if ((_ble_bash>=40200)); then declare -gA _ble_decode_kbd__k2c + _ble_decode_kbd__k2c=() else declare -A _ble_decode_kbd__k2c fi diff --git a/ble-syntax-lazy.sh b/ble-syntax-lazy.sh index be14fdff..4d8f86d4 100644 --- a/ble-syntax-lazy.sh +++ b/ble-syntax-lazy.sh @@ -69,11 +69,11 @@ fi #------------------------------------------------------------------------------ # グローバル変数の定義 (関数内からではできないのでここで先に定義) -if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then +if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then builtin unset -v _ble_syntax_highlight_filetype - builtin unset -v _ble_syntax_highlight_lscolors_ext - if ((_ble_bash>=40300)); then - declare -gA _ble_syntax_highlight_filetype=() + if ((_ble_bash>=40200)); then + declare -gA _ble_syntax_highlight_filetype + _ble_syntax_highlight_filetype=() else declare -A _ble_syntax_highlight_filetype=() fi diff --git a/lib/core-syntax.sh b/lib/core-syntax.sh index f03ed3fc..15d40ab3 100644 --- a/lib/core-syntax.sh +++ b/lib/core-syntax.sh @@ -4543,7 +4543,7 @@ function ble-syntax/highlight/cmdtype2 { ## @param[in] word ## シェル展開・クォート除去を実行する前の文字列を指定します。 ## @var[out] type -if ((_ble_bash>=40300||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then +if ((_ble_bash>=40200||_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then # Note: 連想配列 _ble_syntax_highlight_filetype は ble-syntax-lazy.sh で先に定義される。 _ble_syntax_highlight_filetype_version=-1