diff src/vim9script.c @ 25622:15b54e0a576b v8.2.3347

patch 8.2.3347: check for legacy script is incomplete Commit: https://github.com/vim/vim/commit/dd9de50f4262898384be6ea7694d05507c7cb260 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 15 13:49:42 2021 +0200 patch 8.2.3347: check for legacy script is incomplete Problem: Check for legacy script is incomplete. (Naohiro Ono) Solution: Also check the :legacy modifier. Use for string concatenation with "." and others (issue #8756)
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Aug 2021 14:00:04 +0200
parents 0082503ff2ff
children 4e13cde003a8
line wrap: on
line diff
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -34,6 +34,18 @@ in_vim9script(void)
 
 #if defined(FEAT_EVAL) || defined(PROTO)
 /*
+ * Return TRUE when currently in a script with script version smaller than
+ * "max_version" or command modifiers forced it.
+ */
+    int
+in_old_script(int max_version)
+{
+    return (current_sctx.sc_version <= max_version
+					 && !(cmdmod.cmod_flags & CMOD_VIM9CMD))
+		|| (cmdmod.cmod_flags & CMOD_LEGACY);
+}
+
+/*
  * Return TRUE if the current script is Vim9 script.
  * This also returns TRUE in a legacy function in a Vim9 script.
  */