diff src/vim9execute.c @ 20170:0612c64a2b87 v8.2.0640

patch 8.2.0640: Vim9: expanding does not work Commit: https://github.com/vim/vim/commit/cfe435d7feacf123ac060747b885f7c4328062ea Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 25 20:02:55 2020 +0200 patch 8.2.0640: Vim9: expanding does not work Problem: Vim9: expanding does not work. Solution: Find wildcards in not compiled commands. Reorganize test files.
author Bram Moolenaar <Bram@vim.org>
date Sat, 25 Apr 2020 20:15:03 +0200
parents fe8d0a4344df
children 1d84eaed0ec8
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -648,6 +648,45 @@ call_def_function(
 		do_cmdline_cmd(iptr->isn_arg.string);
 		break;
 
+	    // execute Ex command from pieces on the stack
+	    case ISN_EXECCONCAT:
+		{
+		    int	    count = iptr->isn_arg.number;
+		    int	    len = 0;
+		    int	    pass;
+		    int	    i;
+		    char_u  *cmd = NULL;
+		    char_u  *str;
+
+		    for (pass = 1; pass <= 2; ++pass)
+		    {
+			for (i = 0; i < count; ++i)
+			{
+			    tv = STACK_TV_BOT(i - count);
+			    str = tv->vval.v_string;
+			    if (str != NULL && *str != NUL)
+			    {
+				if (pass == 2)
+				    STRCPY(cmd + len, str);
+				len += STRLEN(str);
+			    }
+			    if (pass == 2)
+				clear_tv(tv);
+			}
+			if (pass == 1)
+			{
+			    cmd = alloc(len + 1);
+			    if (cmd == NULL)
+				goto failed;
+			    len = 0;
+			}
+		    }
+
+		    do_cmdline_cmd(cmd);
+		    vim_free(cmd);
+		}
+		break;
+
 	    // execute :echo {string} ...
 	    case ISN_ECHO:
 		{
@@ -1961,6 +2000,10 @@ ex_disassemble(exarg_T *eap)
 	    case ISN_EXEC:
 		smsg("%4d EXEC %s", current, iptr->isn_arg.string);
 		break;
+	    case ISN_EXECCONCAT:
+		smsg("%4d EXECCONCAT %lld", current,
+					      (long long)iptr->isn_arg.number);
+		break;
 	    case ISN_ECHO:
 		{
 		    echo_T *echo = &iptr->isn_arg.echo;