patch 9.0.0140: execute() does not use the "legacy" command modifier

Problem:    execute() does not use the "legacy" command modifier.
Solution:   pass the command modifier in sticky_cmdmod_flags. (Kota Kato,
            closes #10845)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index ef66aed..da2f35e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3929,6 +3929,7 @@
     int		save_redir_off = redir_off;
     garray_T	save_ga;
     int		save_msg_col = msg_col;
+    int		save_sticky_cmdmod_flags = sticky_cmdmod_flags;
     int		echo_output = FALSE;
 
     rettv->vval.v_string = NULL;
@@ -3985,6 +3986,9 @@
     if (!echo_output)
 	msg_col = 0;  // prevent leading spaces
 
+    // For "legacy call execute('cmd')" and "vim9cmd execute('cmd')" apply the
+    // command modifiers to "cmd".
+    sticky_cmdmod_flags = cmdmod.cmod_flags & (CMOD_LEGACY | CMOD_VIM9CMD);
     if (cmd != NULL)
 	do_cmdline_cmd(cmd);
     else
@@ -3997,6 +4001,7 @@
 		      DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED);
 	--list->lv_refcount;
     }
+    sticky_cmdmod_flags = save_sticky_cmdmod_flags;
 
     // Need to append a NUL to the result.
     if (ga_grow(&redir_execute_ga, 1) == OK)