Patch 8.2.4840
Problem: Heredoc expression evaluated even when skipping.
Solution: Don't evaluate when "skip" is set. (closes #10306)
Files: src/evalvars.c, src/testdir/test_let.vim
*** ../vim-8.2.4839/src/evalvars.c 2022-04-21 23:29:58.944561834 +0100
--- src/evalvars.c 2022-04-28 16:46:16.772679698 +0100
***************
*** 835,841 ****
}
else
{
! if (evalstr)
{
str = eval_all_expr_in_str(str);
if (str == NULL)
--- 835,841 ----
}
else
{
! if (evalstr && !eap->skip)
{
str = eval_all_expr_in_str(str);
if (str == NULL)
*** ../vim-8.2.4839/src/testdir/test_let.vim 2022-04-17 12:46:50.101294003
+0100
--- src/testdir/test_let.vim 2022-04-28 16:50:56.932487984 +0100
***************
*** 509,528 ****
--- 509,532 ----
let c = "abc`=str`d"
END
call assert_equal(['let a = 15', 'let b = 6 + 6', '', 'let c = "abcd"'],
code)
+
let $TESTVAR = "Hello"
let code =<< eval trim END
let s = "`=$TESTVAR`"
END
call assert_equal(['let s = "Hello"'], code)
+
let code =<< eval END
let s = "`=$TESTVAR`"
END
call assert_equal([' let s = "Hello"'], code)
+
let a = 10
let data =<< eval END
`=a`
END
call assert_equal(['10'], data)
+
let x = 'X'
let code =<< eval trim END
let a = `abc`
***************
*** 530,541 ****
--- 534,547 ----
let c = `
END
call assert_equal(['let a = `abc`', 'let b = X', 'let c = `'], code)
+
let code = 'xxx'
let code =<< eval trim END
let n = `=5 +
6`
END
call assert_equal('xxx', code)
+
let code =<< eval trim END
let n = `=min([1, 2]` + `=max([3, 4])`
END
***************
*** 562,567 ****
--- 568,580 ----
LINES
call v9.CheckScriptFailure(lines, 'E15:')
+ " skipped heredoc
+ if 0
+ let msg =<< trim eval END
+ n is: `=n`
+ END
+ endif
+
" Test for sourcing a script containing a heredoc with invalid expression.
" Variable assignment should fail, if expression evaluation fails
new
*** ../vim-8.2.4839/src/version.c 2022-04-28 15:39:04.462219876 +0100
--- src/version.c 2022-04-28 16:48:19.904595438 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4840,
/**/
--
hundred-and-one symptoms of being an internet addict:
89. In addition to your e-mail address being on your business
cards you even have your own domain.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220428155248.C8AC61C1606%40moolenaar.net.