summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/eval.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/src/eval.c b/src/eval.c
index 815d13d..69b8374 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1901,7 +1901,7 @@ set_var_lval(
&& !tv_check_lock(&di->di_tv, lp->ll_name, FALSE)))
&& tv_op(&tv, rettv, op) == OK)
set_var_const(lp->ll_name, lp->ll_sid, NULL, &tv, FALSE,
- ASSIGN_NO_DECL, 0);
+ ASSIGN_NO_DECL | ASSIGN_COMPOUND_OP, 0);
clear_tv(&tv);
}
}
@@ -2699,6 +2699,9 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
/*
* To be called after eval_next_non_blank() sets "getnext" to TRUE.
* Only called for Vim9 script.
+ *
+ * If "arg" is not NULL, then the caller should assign the return value to
+ * "arg".
*/
char_u *
eval_next_line(char_u *arg, evalarg_T *evalarg)
@@ -2747,8 +2750,12 @@ eval_next_line(char_u *arg, evalarg_T *evalarg)
}
// Advanced to the next line, "arg" no longer points into the previous
- // line.
- evalarg->eval_using_cmdline = FALSE;
+ // line. The caller assigns the return value to "arg".
+ // If "arg" is NULL, then the return value is discarded. In that case,
+ // "arg" still points to the previous line. So don't reset
+ // "eval_using_cmdline".
+ if (arg != NULL)
+ evalarg->eval_using_cmdline = FALSE;
return skipwhite(line);
}
@@ -6311,36 +6318,9 @@ echo_string_core(
break;
case VAR_OBJECT:
- {
- garray_T ga;
- ga_init2(&ga, 1, 50);
- ga_concat(&ga, (char_u *)"object of ");
- object_T *obj = tv->vval.v_object;
- class_T *cl = obj == NULL ? NULL : obj->obj_class;
- ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]"
- : cl->class_name);
- if (cl != NULL)
- {
- ga_concat(&ga, (char_u *)" {");
- for (int i = 0; i < cl->class_obj_member_count; ++i)
- {
- if (i > 0)
- ga_concat(&ga, (char_u *)", ");
- ocmember_T *m = &cl->class_obj_members[i];
- ga_concat(&ga, m->ocm_name);
- ga_concat(&ga, (char_u *)": ");
- char_u *tf = NULL;
- ga_concat(&ga, echo_string_core(
- (typval_T *)(obj + 1) + i,
- &tf, numbuf, copyID, echo_style,
- restore_copyID, composite_val));
- vim_free(tf);
- }
- ga_concat(&ga, (char_u *)"}");
- }
-
- *tofree = r = ga.ga_data;
- }
+ *tofree = r = object_string(tv->vval.v_object, numbuf, copyID,
+ echo_style, restore_copyID,
+ composite_val);
break;
case VAR_FLOAT:
@@ -6488,7 +6468,7 @@ var2fpos(
if (charcol)
len = (long)mb_charlen(ml_get(pos.lnum));
else
- len = (long)STRLEN(ml_get(pos.lnum));
+ len = (long)ml_get_len(pos.lnum);
// Get the column number
// We accept "$" for the column number: last column.
@@ -6594,7 +6574,7 @@ var2fpos(
if (charcol)
pos.col = (colnr_T)mb_charlen(ml_get_curline());
else
- pos.col = (colnr_T)STRLEN(ml_get_curline());
+ pos.col = ml_get_curline_len();
}
return &pos;
}