Skip to content

Commit e525bdd

Browse files
committed
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Problem: Vim9: after "if false" line breaks in expression not skipped. Solution: Do parse the expression. (closes #8723)
1 parent dae453f commit e525bdd

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/testdir/test_vim9_script.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,6 +2372,14 @@ def Test_if_const_expr()
23722372
if false
23732373
burp
23742374
endif
2375+
2376+
# expression with line breaks skipped
2377+
if false
2378+
('aaa'
2379+
.. 'bbb'
2380+
.. 'ccc'
2381+
)->setline(1)
2382+
endif
23752383
enddef
23762384

23772385
def Test_if_const_expr_fails()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3312,
758760
/**/
759761
3311,
760762
/**/

src/vim9compile.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9730,14 +9730,12 @@ compile_def_function(
97309730

97319731
if (p == ea.cmd && ea.cmdidx != CMD_SIZE)
97329732
{
9733-
if (cctx.ctx_skip == SKIP_YES)
9733+
if (cctx.ctx_skip == SKIP_YES && ea.cmdidx != CMD_eval)
97349734
{
97359735
line += STRLEN(line);
97369736
goto nextline;
97379737
}
9738-
9739-
// Expression or function call.
9740-
if (ea.cmdidx != CMD_eval)
9738+
else if (ea.cmdidx != CMD_eval)
97419739
{
97429740
// CMD_var cannot happen, compile_assignment() above would be
97439741
// used. Most likely an assignment to a non-existing variable.

0 commit comments

Comments
 (0)