summaryrefslogtreecommitdiff
path: root/src/vim9script.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-15 13:49:42 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-15 13:49:42 +0200
commitdd9de50f4262898384be6ea7694d05507c7cb260 (patch)
tree7065a785ee6bd7f1a9dd30ff09bf800aa6bd9699 /src/vim9script.c
parent2596a4e763e11eb8e406f262cb72fd2b39461572 (diff)
downloadvim-git-dd9de50f4262898384be6ea7694d05507c7cb260.tar.gz
patch 8.2.3347: check for legacy script is incompletev8.2.3347
Problem: Check for legacy script is incomplete. (Naohiro Ono) Solution: Also check the :legacy modifier. Use for string concatenation with "." and others (issue #8756)
Diffstat (limited to 'src/vim9script.c')
-rw-r--r--src/vim9script.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vim9script.c b/src/vim9script.c
index 66305a304..19991097a 100644
--- 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.
*/