Patch 8.2.1501
Problem: Vim9: concatenating to constant reverses order.
Solution: Generate constant before option, register and environment
variable. (closes #6757)
Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim
*** ../vim-8.2.1500/src/vim9compile.c 2020-08-20 23:04:03.103928227 +0200
--- src/vim9compile.c 2020-08-21 20:34:23.508040141 +0200
***************
*** 3402,3420 ****
/*
* Option value: &name
*/
! case '&': ret = compile_get_option(arg, cctx);
break;
/*
* Environment variable: $VAR.
*/
! case '$': ret = compile_get_env(arg, cctx);
break;
/*
* Register contents: @r.
*/
! case '@': ret = compile_get_register(arg, cctx);
break;
/*
* nested expression: (expression).
--- 3402,3426 ----
/*
* Option value: &name
*/
! case '&': if (generate_ppconst(cctx, ppconst) == FAIL)
! return FAIL;
! ret = compile_get_option(arg, cctx);
break;
/*
* Environment variable: $VAR.
*/
! case '$': if (generate_ppconst(cctx, ppconst) == FAIL)
! return FAIL;
! ret = compile_get_env(arg, cctx);
break;
/*
* Register contents: @r.
*/
! case '@': if (generate_ppconst(cctx, ppconst) == FAIL)
! return FAIL;
! ret = compile_get_register(arg, cctx);
break;
/*
* nested expression: (expression).
*** ../vim-8.2.1500/src/testdir/test_vim9_expr.vim 2020-08-18 22:31:41.664654206 +0200
--- src/testdir/test_vim9_expr.vim 2020-08-21 20:37:42.599144053 +0200
***************
*** 944,949 ****
--- 944,961 ----
+ g:ablob)
assert_equal(0z01ab3344, g:ablob + 0z3344)
assert_equal(0z01ab01ab, g:ablob + g:ablob)
+
+ # concatenate non-constant to constant
+ let save_path = &path
+ &path = 'b'
+ assert_equal('ab', 'a' .. &path)
+ &path = save_path
+
+ @b = 'b'
+ assert_equal('ab', 'a' .. @b)
+
+ $ENVVAR = 'env'
+ assert_equal('aenv', 'a' .. $ENVVAR)
enddef
def Test_expr5_vim9script()
*** ../vim-8.2.1500/src/version.c 2020-08-20 23:04:03.103928227 +0200
--- src/version.c 2020-08-21 20:39:15.334679847 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1501,
/**/
--
hundred-and-one symptoms of being an internet addict:
256. You are able to write down over 250 symptoms of being an internet
addict, even though they only asked for 101.
/// Bram Moolenaar -- Br...@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 ///