From 643ce6c0c694667a2afd24bb39d8e9d36d94d7a9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 6 Apr 2021 21:17:27 +0200 Subject: patch 8.2.2729: Vim9: wrong error message for referring to legacy script var Problem: Vim9: wrong error message for referring to legacy script variable. Solution: Do allow referring to a variable in legacy script without "s:" if it exists at compile time. (closes #8076) --- src/vim9compile.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/vim9compile.c') diff --git a/src/vim9compile.c b/src/vim9compile.c index 6ff00f7d4..c9ca5953f 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -5708,17 +5708,9 @@ generate_store_var( return generate_STORE(cctx, ISN_STOREV, vimvaridx, NULL); case dest_script: if (scriptvar_idx < 0) - { - char_u *name_s = name; - int r; - - // "s:" is included in the name. - r = generate_OLDSCRIPT(cctx, ISN_STORES, name_s, + // "s:" may be included in the name. + return generate_OLDSCRIPT(cctx, ISN_STORES, name, scriptvar_sid, type); - if (name_s != name) - vim_free(name_s); - return r; - } return generate_VIM9SCRIPT(cctx, ISN_STORESCRIPT, scriptvar_sid, scriptvar_idx, type); case dest_local: @@ -5854,7 +5846,7 @@ compile_lhs( ? script_var_exists(var_start + 2, lhs->lhs_varlen - 2, FALSE, cctx) : script_var_exists(var_start, lhs->lhs_varlen, - TRUE, cctx)) == OK; + FALSE, cctx)) == OK; imported_T *import = find_imported(var_start, lhs->lhs_varlen, cctx); -- cgit v1.2.1