diff src/userfunc.c @ 19201:e7b4fff348dd v8.2.0159

patch 8.2.0159: non-materialized range() list causes problems Commit: https://github.com/vim/vim/commit/50985eb1f0bd3c73ce727f9bbd66c839c92ef0da Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 27 22:09:39 2020 +0100 patch 8.2.0159: non-materialized range() list causes problems Problem: Non-materialized range() list causes problems. (Fujiwara Takuya) Solution: Materialize the list where needed.
author Bram Moolenaar <Bram@vim.org>
date Mon, 27 Jan 2020 22:15:07 +0100
parents 1168c53d1b49
children 77cd94083850
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1600,13 +1600,14 @@ func_call(
     dict_T	*selfdict,
     typval_T	*rettv)
 {
+    list_T	*l = args->vval.v_list;
     listitem_T	*item;
     typval_T	argv[MAX_FUNC_ARGS + 1];
     int		argc = 0;
     int		r = 0;
 
-    for (item = args->vval.v_list->lv_first; item != NULL;
-							 item = item->li_next)
+    range_list_materialize(l);
+    for (item = l->lv_first; item != NULL; item = item->li_next)
     {
 	if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc))
 	{