mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
eval/typval_encode: Dump empty dictionary before checking for refcycle
Otherwise copyID will stay forever on empty dictionaries.
This commit is contained in:
parent
10c6e68db6
commit
1052009b37
@ -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,24 +718,20 @@ typval_encode_stop_converting_one_item:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dict->dv_hashtab.ht_used == 0) {
|
TYPVAL_ENCODE_CONV_DICT_START(NULL, pt->pt_dict,
|
||||||
TYPVAL_ENCODE_CONV_EMPTY_DICT(NULL, pt->pt_dict);
|
dict->dv_hashtab.ht_used);
|
||||||
} else {
|
_mp_push(mpstack, ((MPConvStackVal) {
|
||||||
TYPVAL_ENCODE_CONV_DICT_START(NULL, pt->pt_dict,
|
.type = kMPConvDict,
|
||||||
dict->dv_hashtab.ht_used);
|
.tv = NULL,
|
||||||
_mp_push(mpstack, ((MPConvStackVal) {
|
.data = {
|
||||||
.type = kMPConvDict,
|
.d = {
|
||||||
.tv = NULL,
|
.dict = dict,
|
||||||
.data = {
|
.dictp = &pt->pt_dict,
|
||||||
.d = {
|
.hi = dict->dv_hashtab.ht_array,
|
||||||
.dict = dict,
|
.todo = dict->dv_hashtab.ht_used,
|
||||||
.dictp = &pt->pt_dict,
|
|
||||||
.hi = dict->dv_hashtab.ht_array,
|
|
||||||
.todo = dict->dv_hashtab.ht_used,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}));
|
},
|
||||||
}
|
}));
|
||||||
} else {
|
} else {
|
||||||
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, -1);
|
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, -1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user