forked from aniani/vim
patch 8.2.1501: Vim9: concatenating to constant reverses order
Problem: Vim9: concatenating to constant reverses order. Solution: Generate constant before option, register and environment variable. (closes #6757)
This commit is contained in:
parent
5d72ce69c8
commit
3fc71285d5
@ -944,6 +944,18 @@ def Test_expr5()
|
|||||||
+ g:ablob)
|
+ g:ablob)
|
||||||
assert_equal(0z01ab3344, g:ablob + 0z3344)
|
assert_equal(0z01ab3344, g:ablob + 0z3344)
|
||||||
assert_equal(0z01ab01ab, g:ablob + g:ablob)
|
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
|
enddef
|
||||||
|
|
||||||
def Test_expr5_vim9script()
|
def Test_expr5_vim9script()
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1501,
|
||||||
/**/
|
/**/
|
||||||
1500,
|
1500,
|
||||||
/**/
|
/**/
|
||||||
|
@ -3402,19 +3402,25 @@ compile_expr7(
|
|||||||
/*
|
/*
|
||||||
* Option value: &name
|
* Option value: &name
|
||||||
*/
|
*/
|
||||||
case '&': ret = compile_get_option(arg, cctx);
|
case '&': if (generate_ppconst(cctx, ppconst) == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
ret = compile_get_option(arg, cctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Environment variable: $VAR.
|
* Environment variable: $VAR.
|
||||||
*/
|
*/
|
||||||
case '$': ret = compile_get_env(arg, cctx);
|
case '$': if (generate_ppconst(cctx, ppconst) == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
ret = compile_get_env(arg, cctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register contents: @r.
|
* Register contents: @r.
|
||||||
*/
|
*/
|
||||||
case '@': ret = compile_get_register(arg, cctx);
|
case '@': if (generate_ppconst(cctx, ppconst) == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
ret = compile_get_register(arg, cctx);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
* nested expression: (expression).
|
* nested expression: (expression).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user