summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-05-17 18:20:43 +0200
committerChristian Brabandt <cb@256bit.org>2024-05-17 18:20:43 +0200
commitfe424d13ef6e5486923f23f15bb6951e3079412e (patch)
tree7d0bcbeab9b24aa19a24296f9e8e210ad238cc35 /src/eval.c
parente595e9c31b651bcb15d2f40ff00fffa432370484 (diff)
patch 9.1.0415: Some functions are not testedv9.1.0415
Problem: Some functions are not tested Solution: Add a few more tests, fix a few minor problems (Yegappan Lakshmanan) closes: #14789 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/eval.c b/src/eval.c
index 93dc09192e..322b45aaef 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2281,9 +2281,16 @@ tv_op_blob(typval_T *tv1, typval_T *tv2, char_u *op)
return FAIL;
// Blob += Blob
- if (tv1->vval.v_blob == NULL || tv2->vval.v_blob == NULL)
+ if (tv2->vval.v_blob == NULL)
return OK;
+ if (tv1->vval.v_blob == NULL)
+ {
+ tv1->vval.v_blob = tv2->vval.v_blob;
+ ++tv1->vval.v_blob->bv_refcount;
+ return OK;
+ }
+
blob_T *b1 = tv1->vval.v_blob;
blob_T *b2 = tv2->vval.v_blob;
int len = blob_len(b2);
@@ -2455,12 +2462,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
return FAIL;
}
- if (tv2->v_type == VAR_CLASS || tv2->v_type == VAR_TYPEALIAS)
- {
- check_typval_is_value(tv2);
- return FAIL;
- }
-
int retval = FAIL;
switch (tv1->v_type)
{
@@ -2476,12 +2477,9 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
case VAR_CHANNEL:
case VAR_INSTR:
case VAR_OBJECT:
- break;
-
case VAR_CLASS:
case VAR_TYPEALIAS:
- check_typval_is_value(tv1);
- return FAIL;
+ break;
case VAR_BLOB:
retval = tv_op_blob(tv1, tv2, op);
@@ -5162,7 +5160,7 @@ eval_method(
{
*arg = name;
- // Truncate the name a the "(". Avoid trying to get another line
+ // Truncate the name at the "(". Avoid trying to get another line
// by making "getline" NULL.
*paren = NUL;
char_u *(*getline)(int, void *, int, getline_opt_T) = NULL;
@@ -5217,6 +5215,9 @@ eval_method(
clear_tv(&base);
vim_free(tofree);
+ if (alias != NULL)
+ vim_free(alias);
+
return ret;
}
@@ -5434,7 +5435,7 @@ f_slice(typval_T *argvars, typval_T *rettv)
|| check_for_opt_number_arg(argvars, 2) == FAIL))
return;
- if (check_can_index(argvars, TRUE, FALSE) != OK)
+ if (check_can_index(&argvars[0], TRUE, FALSE) != OK)
return;
copy_tv(argvars, rettv);