Patch 8.2.3807

9 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 14, 2021, 7:08:16 AM12/14/21
to vim...@googlegroups.com

Patch 8.2.3807
Problem: Vim9: can call import with star directly.
Solution: Check that the import used star.
Files: src/userfunc.c, src/eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.3806/src/userfunc.c 2021-12-13 19:14:48.597409503 +0000
--- src/userfunc.c 2021-12-14 12:02:04.650038528 +0000
***************
*** 1596,1602 ****
*lenp = (int)STRLEN(s);
return s;
}
! // TODO: what if (import->imp_flags & IMP_FLAGS_STAR)
{
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
--- 1596,1611 ----
*lenp = (int)STRLEN(s);
return s;
}
! if (import->imp_flags & IMP_FLAGS_STAR)
! {
! name[len] = NUL;
! semsg(_(e_cannot_use_str_itself_it_is_imported_with_star),
! name);
! name[len] = cc;
! *lenp = 0;
! return (char_u *)""; // just in case
! }
! else
{
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
*** ../vim-8.2.3806/src/eval.c 2021-12-13 14:26:40.992627753 +0000
--- src/eval.c 2021-12-14 11:56:06.134170616 +0000
***************
*** 2001,2007 ****
// Need to make a copy, in case evaluating the arguments makes
// the name invalid.
s = vim_strsave(s);
! if (s == NULL || (flags & EVAL_CONSTANT))
ret = FAIL;
else
{
--- 2001,2007 ----
// Need to make a copy, in case evaluating the arguments makes
// the name invalid.
s = vim_strsave(s);
! if (s == NULL || *s == NUL || (flags & EVAL_CONSTANT))
ret = FAIL;
else
{
*** ../vim-8.2.3806/src/testdir/test_vim9_script.vim 2021-12-11 16:13:32.231721218 +0000
--- src/testdir/test_vim9_script.vim 2021-12-14 12:01:20.194057270 +0000
***************
*** 1536,1541 ****
--- 1536,1556 ----
CheckScriptFailure(lines, 'E1047:')

delete('Xfoo.vim')
+
+ lines =<< trim END
+ vim9script
+ def TheFunc()
+ echo 'the func'
+ enddef
+ export var Ref = TheFunc
+ END
+ writefile([], 'Xthat.vim')
+ lines =<< trim END
+ import * as That from './Xthat.vim'
+ That()
+ END
+ CheckDefAndScriptFailure2(lines, 'E1094:', 'E1236: Cannot use That itself')
+ delete('Xthat.vim')
enddef

def Test_import_as()
*** ../vim-8.2.3806/src/version.c 2021-12-14 11:16:26.814008783 +0000
--- src/version.c 2021-12-14 11:52:54.706217009 +0000
***************
*** 751,752 ****
--- 751,754 ----
{ /* Add new patch number below this line */
+ /**/
+ 3807,
/**/

--
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
R. B. Forest

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Bram Moolenaar

unread,
Dec 14, 2021, 8:38:06 AM12/14/21
to vim...@googlegroups.com, Bram Moolenaar

I wrote:

> Patch 8.2.3807
> Problem: Vim9: can call import with star directly.
> Solution: Check that the import used star.
> Files: src/userfunc.c, src/eval.c, src/testdir/test_vim9_script.vim

Unexpectedly this makes Test_expr4_equal() fail. That is weird, since
the failing assert is inside !has('win32'). This smells like some kind
of corruption.

Can someone run this test with valgrind under MS-Windows to see what
happens? On Linux it all works fine.

--
hundred-and-one symptoms of being an internet addict:
30. Even though you died last week, you've managed to retain OPS on your
favorite IRC channel.
Reply all
Reply to author
Forward
0 new messages