mirror of
https://github.com/neovim/neovim.git
synced 2025-09-21 10:48:18 +00:00
eval/typval_encode: Dump empty dictionary before checking for refcycle
Otherwise copyID will stay forever on empty dictionaries.
This commit is contained in:
@@ -703,6 +703,10 @@ typval_encode_stop_converting_one_item:
|
|||||||
dict_T *const dict = pt == NULL ? NULL : pt->pt_dict;
|
dict_T *const dict = pt == NULL ? NULL : pt->pt_dict;
|
||||||
if (dict != NULL) {
|
if (dict != NULL) {
|
||||||
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, dict->dv_hashtab.ht_used);
|
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, dict->dv_hashtab.ht_used);
|
||||||
|
if (dict->dv_hashtab.ht_used == 0) {
|
||||||
|
TYPVAL_ENCODE_CONV_EMPTY_DICT(NULL, pt->pt_dict);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const int te_csr_ret = _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
|
const int te_csr_ret = _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
|
||||||
TYPVAL_ENCODE_FIRST_ARG_NAME,
|
TYPVAL_ENCODE_FIRST_ARG_NAME,
|
||||||
dict, &dict->dv_copyID, &mpstack, copyID, kMPConvDict,
|
dict, &dict->dv_copyID, &mpstack, copyID, kMPConvDict,
|
||||||
@@ -714,9 +718,6 @@ typval_encode_stop_converting_one_item:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dict->dv_hashtab.ht_used == 0) {
|
|
||||||
TYPVAL_ENCODE_CONV_EMPTY_DICT(NULL, pt->pt_dict);
|
|
||||||
} else {
|
|
||||||
TYPVAL_ENCODE_CONV_DICT_START(NULL, pt->pt_dict,
|
TYPVAL_ENCODE_CONV_DICT_START(NULL, pt->pt_dict,
|
||||||
dict->dv_hashtab.ht_used);
|
dict->dv_hashtab.ht_used);
|
||||||
_mp_push(mpstack, ((MPConvStackVal) {
|
_mp_push(mpstack, ((MPConvStackVal) {
|
||||||
@@ -731,7 +732,6 @@ typval_encode_stop_converting_one_item:
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, -1);
|
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, -1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user