To: vim_dev@googlegroups.com Subject: Patch 8.2.0283 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0283 Problem: Vim9: failing to load script var not tested. Solution: Add more tests. Fix using s: in old script. Files: src/testdir/test_vim9_expr.vim, src/vim9compile.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.0282/src/testdir/test_vim9_expr.vim 2020-02-19 18:14:35.733852144 +0100 --- src/testdir/test_vim9_expr.vim 2020-02-19 20:09:35.771507350 +0100 *************** *** 726,731 **** --- 726,734 ---- call CheckDefFailure("let x = ¬exist", 'E113:') call CheckDefExecFailure("&grepprg = [343]", 'E1051:') + + call CheckDefExecFailure("echo s:doesnt_exist", 'E121:') + call CheckDefExecFailure("echo g:doesnt_exist", 'E121:') endfunc let g:Funcrefs = [function('add')] *** ../vim-8.2.0282/src/vim9compile.c 2020-02-19 12:40:36.343661114 +0100 --- src/vim9compile.c 2020-02-19 20:16:30.214211585 +0100 *************** *** 1513,1521 **** int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE); imported_T *import; ! if (idx == -1) { ! // variable exists but is not in sn_var_vals: old style script. return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid, &t_any); } --- 1513,1521 ---- int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE); imported_T *import; ! if (idx == -1 || si->sn_version != SCRIPT_VERSION_VIM9) { ! // variable is not in sn_var_vals: old style script. return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid, &t_any); } *************** *** 1627,1633 **** || (len == 5 && STRNCMP("false", *arg, 5) == 0)) res = generate_PUSHBOOL(cctx, **arg == 't' ? VVAL_TRUE : VVAL_FALSE); ! else res = compile_load_scriptvar(cctx, name); } } --- 1627,1635 ---- || (len == 5 && STRNCMP("false", *arg, 5) == 0)) res = generate_PUSHBOOL(cctx, **arg == 't' ? VVAL_TRUE : VVAL_FALSE); ! else if (SCRIPT_ITEM(current_sctx.sc_sid)->sn_version ! == SCRIPT_VERSION_VIM9) ! // in Vim9 script "var" can be script-local. res = compile_load_scriptvar(cctx, name); } } *** ../vim-8.2.0282/src/testdir/test_vim9_script.vim 2020-02-19 18:14:35.733852144 +0100 --- src/testdir/test_vim9_script.vim 2020-02-19 20:18:24.009851877 +0100 *************** *** 61,70 **** assert_equal('foobar', $ENVVAR) $ENVVAR = '' ! appendToMe ..= 'yyy' ! assert_equal('xxxyyy', appendToMe) ! addToMe += 222 ! assert_equal(333, addToMe) enddef func Test_assignment_failure() --- 61,70 ---- assert_equal('foobar', $ENVVAR) $ENVVAR = '' ! s:appendToMe ..= 'yyy' ! assert_equal('xxxyyy', s:appendToMe) ! s:addToMe += 222 ! assert_equal(333, s:addToMe) enddef func Test_assignment_failure() *** ../vim-8.2.0282/src/version.c 2020-02-19 18:14:35.737852134 +0100 --- src/version.c 2020-02-19 20:08:33.563699048 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 283, /**/ -- From "know your smileys": :-& Eating spaghetti /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///