diff src/fold.c @ 25384:e8e2c4d33b9b v8.2.3229

patch 8.2.3229: Vim9: runtime and compile time type checks are not the same Commit: https://github.com/vim/vim/commit/4490ec4e839e45a2e6923c265c7e9e64c240b805 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Jul 27 22:00:44 2021 +0200 patch 8.2.3229: Vim9: runtime and compile time type checks are not the same Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jul 2021 22:15:06 +0200
parents 8f2262c72178
children 2484d6d96166
line wrap: on
line diff
--- a/src/fold.c
+++ b/src/fold.c
@@ -3658,6 +3658,9 @@ foldclosed_both(
     linenr_T	lnum;
     linenr_T	first, last;
 
+    if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+	return;
+
     lnum = tv_get_lnum(argvars);
     if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
     {
@@ -3701,6 +3704,9 @@ f_foldlevel(typval_T *argvars UNUSED, ty
 # ifdef FEAT_FOLDING
     linenr_T	lnum;
 
+    if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+	return;
+
     lnum = tv_get_lnum(argvars);
     if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
 	rettv->vval.v_number = foldLevel(lnum);
@@ -3789,6 +3795,10 @@ f_foldtextresult(typval_T *argvars UNUSE
 
     rettv->v_type = VAR_STRING;
     rettv->vval.v_string = NULL;
+
+    if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+	return;
+
 # ifdef FEAT_FOLDING
     if (entered)
 	return; // reject recursive use