Skip to content

Commit 3f6eab0

Browse files
Don't add semicolons to label statements
1 parent 10104c5 commit 3f6eab0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CodeFormatCore/src/Format/Analyzer/SemicolonAnalyzer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ void SemicolonAnalyzer::Analyze(FormatState &f, const LuaSyntaxTree &t) {
1616
if (detail::multi_match::StatementMatch(syntaxNode.GetSyntaxKind(t))) {
1717
switch (f.GetStyle().end_statement_with_semicolon) {
1818
case EndStmtWithSemicolon::Always: {
19+
if (syntaxNode.GetSyntaxKind(t) == LuaSyntaxNodeKind::LabelStatement) {
20+
break; // labels should not end with semicolons
21+
}
1922
if (!EndsWithSemicolon(syntaxNode, t)) {
2023
AddSemicolon(syntaxNode, t);
2124
}

LuaParser/src/Parse/LuaParser.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,6 @@ void LuaParser::LabelStatement() {
413413

414414
CheckAndNext(TK_DBCOLON);
415415

416-
TestAndNext(';');
417-
418416
m.Complete(*this, LuaSyntaxNodeKind::LabelStatement);
419417
}
420418

0 commit comments

Comments
 (0)