Skip to content

Commit 653f611

Browse files
committed
兼容break 和goto后的分号
1 parent 24dce2d commit 653f611

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CodeService/src/FormatElement/IndentElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void IndentElement::EnableDisableFormat()
3838
_formatControl = DisableFormat::Disable;
3939
}
4040

41-
bool IndentElement::IsDisableEnv()
41+
bool IndentElement::IsDisableEnv() const
4242
{
4343
return _formatControl != DisableFormat::None;
4444
}

LuaParser/src/LuaParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ void LuaParser::BreakStatement(std::shared_ptr<LuaAstNode> blockNode)
491491
auto breakStatement = CreateAstNode(LuaAstNodeType::BreakStatement);
492492

493493
CheckAndNext(TK_BREAK, breakStatement);
494+
495+
TestNext(';', breakStatement, LuaAstNodeType::GeneralOperator);
494496
blockNode->AddChild(breakStatement);
495497
}
496498

@@ -502,6 +504,7 @@ void LuaParser::GotoStatement(std::shared_ptr<LuaAstNode> blockNode)
502504

503505
CheckName(gotoStatement);
504506

507+
TestNext(';', gotoStatement, LuaAstNodeType::GeneralOperator);
505508
blockNode->AddChild(gotoStatement);
506509
}
507510

include/CodeService/FormatElement/IndentElement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class IndentElement : public FormatElement
2121

2222
void EnableDisableFormat();
2323

24-
bool IsDisableEnv();
24+
bool IsDisableEnv() const;
2525

2626
void AddChild(std::shared_ptr<FormatElement> child) override;
2727

0 commit comments

Comments
 (0)