diff src/sound.c @ 25356:1cde96e768e4 v8.2.3215

patch 8.2.3215: Vim9: argument types are not checked at compile time Commit: https://github.com/vim/vim/commit/5bca906b307728fa74a112914dc55b424d512d39 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Jul 24 21:33:26 2021 +0200 patch 8.2.3215: Vim9: argument types are not checked at compile time Problem: Vim9: argument types are not checked at compile time. Solution: Add several more type checks. Sort the argument lists. (Yegappan Lakshmanan, closes #8626)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jul 2021 21:45:04 +0200
parents 237dace53473
children e8e2c4d33b9b
line wrap: on
line diff
--- a/src/sound.c
+++ b/src/sound.c
@@ -179,6 +179,9 @@ invoke_sound_callback(void)
     static void
 sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
 {
+    if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+	return;
+
     if (context == NULL)
 	ca_context_create(&context);
     if (context != NULL)
@@ -351,6 +354,9 @@ f_sound_playevent(typval_T *argvars, typ
 {
     WCHAR	    *wp;
 
+    if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+	return;
+
     wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL);
     if (wp == NULL)
 	return;
@@ -371,6 +377,9 @@ f_sound_playfile(typval_T *argvars, typv
     char	buf[32];
     MCIERROR	err;
 
+    if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+	return;
+
     esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE);
 
     len = STRLEN(esc) + 5 + 18 + 1;