summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-02 20:01:27 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-02 20:01:27 +0000
commit381692b6f1c2ec9b73a139500286ddc9347a1c01 (patch)
tree96145ec58ad29dd86bbc80e557377333c07d059b /src/eval.c
parenta1c519518050383e7d319514a3ff6c42a9154c48 (diff)
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()v8.2.4286
Problem: Vim9: strict type checking after copy() and deepcopy(). Solution: Allow type to change after making a copy. (closes #9644)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 076ba1fed3..b5ccc4bdfb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6160,6 +6160,7 @@ handle_subscript(
/*
* Make a copy of an item.
* Lists and Dictionaries are also copied. A deep copy if "deep" is set.
+ * "top" is TRUE for the toplevel of copy().
* For deepcopy() "copyID" is zero for a full copy or the ID for when a
* reference to an already copied list/dict can be used.
* Returns FAIL or OK.
@@ -6169,6 +6170,7 @@ item_copy(
typval_T *from,
typval_T *to,
int deep,
+ int top,
int copyID)
{
static int recurse = 0;
@@ -6207,7 +6209,8 @@ item_copy(
++to->vval.v_list->lv_refcount;
}
else
- to->vval.v_list = list_copy(from->vval.v_list, deep, copyID);
+ to->vval.v_list = list_copy(from->vval.v_list,
+ deep, top, copyID);
if (to->vval.v_list == NULL)
ret = FAIL;
break;
@@ -6226,7 +6229,8 @@ item_copy(
++to->vval.v_dict->dv_refcount;
}
else
- to->vval.v_dict = dict_copy(from->vval.v_dict, deep, copyID);
+ to->vval.v_dict = dict_copy(from->vval.v_dict,
+ deep, top, copyID);
if (to->vval.v_dict == NULL)
ret = FAIL;
break;