Problem: :const cannot be followed by "| endif".
Solution: Check following command for :const. (closes #5269)
Also fix completion after :const.
break;
#endif
#ifdef FEAT_EVAL
+ case CMD_const:
case CMD_let:
case CMD_if:
case CMD_elseif:
int c;
char_u *p;
- if (cmdidx == CMD_let)
+ if (cmdidx == CMD_let || cmdidx == CMD_const)
{
xp->xp_context = EXPAND_USER_VARS;
if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL)
case CMD_browse:
case CMD_call:
case CMD_confirm:
+ case CMD_const:
case CMD_delfunction:
case CMD_djump:
case CMD_dlist:
endif
for cmd in [
\ 'let a = ',
+ \ 'const a = ',
\ 'if',
\ 'elseif',
\ 'while',
call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:')
endfunc
+func Test_const_with_condition()
+ const x = 0
+ if 0 | const x = 1 | endif
+ call assert_equal(0, x)
+endfunc
+
func Test_const_with_index_access()
let l = [1, 2, 3]
call assert_fails('const l[0] = 4', 'E996:')
let out = execute('let a {0 == 1 ? "a" : "b"}')
let s = "\na #1\nb #2"
call assert_equal(s, out)
+
+ let x = 0
+ if 0 | let x = 1 | endif
+ call assert_equal(0, x)
endfunc
func s:set_arg1(a) abort
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2348,
/**/
2347,
/**/