Skip to content

Commit

Permalink
Don't raise 'else if' warning if 'else' and 'if' are not on the same …
Browse files Browse the repository at this point in the history
…line
  • Loading branch information
Sainan authored and well-in-that-case committed Jun 25, 2024
1 parent 7f7e8e7 commit e197eba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4296,7 +4296,7 @@ static void ifstat (LexState *ls, int line, TypeHint *prop = nullptr) {
leaveblock(fs);
enterblock(fs, &walrusbl, BlockType::BT_DEFAULT);
}
if (ls->t.token == TK_IF)
if (ls->t.token == TK_IF && ls->t.line == luaX_lookbehind(ls).line)
ls->else_if = ls->getLineNumber();
block(ls, prop); /* 'else' part */
}
Expand Down

0 comments on commit e197eba

Please sign in to comment.