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 -- [email protected] -- 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    ///

-- 
-- 
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/202008211844.07LIi2mE529061%40masaka.moolenaar.net.

Raspunde prin e-mail lui