diff src/vim9execute.c @ 21835:b530ead4265a v8.2.1467

patch 8.2.1467: Vim9: :echomsg doesn't like a dict argument Commit: https://github.com/vim/vim/commit/e5abf7af08ff69e7e038c067497f080d4e44332c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 16 18:29:35 2020 +0200 patch 8.2.1467: Vim9: :echomsg doesn't like a dict argument Problem: Vim9: :echomsg doesn't like a dict argument. Solution: Convert arguments like in legacy script. (closes https://github.com/vim/vim/issues/6717)
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Aug 2020 18:30:04 +0200
parents e3f9528bddda
children 3e5d0832a2e7
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1028,14 +1028,20 @@ call_def_function(
 		    for (idx = 0; idx < count; ++idx)
 		    {
 			tv = STACK_TV_BOT(idx - count);
-			if (tv->v_type == VAR_CHANNEL || tv->v_type == VAR_JOB)
+			if (iptr->isn_type == ISN_EXECUTE)
 			{
-			    SOURCING_LNUM = iptr->isn_lnum;
-			    emsg(_(e_inval_string));
-			    break;
+			    if (tv->v_type == VAR_CHANNEL
+						      || tv->v_type == VAR_JOB)
+			    {
+				SOURCING_LNUM = iptr->isn_lnum;
+				emsg(_(e_inval_string));
+				break;
+			    }
+			    else
+				p = tv_get_string_buf(tv, buf);
 			}
 			else
-			    p = tv_get_string_buf(tv, buf);
+			    p = tv_stringify(tv, buf);
 
 			len = (int)STRLEN(p);
 			if (ga_grow(&ga, len + 2) == FAIL)
@@ -1050,8 +1056,10 @@ call_def_function(
 			clear_tv(tv);
 		    }
 		    ectx.ec_stack.ga_len -= count;
-
-		    if (!failed && ga.ga_data != NULL)
+		    if (failed)
+			goto on_error;
+
+		    if (ga.ga_data != NULL)
 		    {
 			if (iptr->isn_type == ISN_EXECUTE)
 			    do_cmdline_cmd((char_u *)ga.ga_data);