We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66a38c0 commit 7f903e2Copy full SHA for 7f903e2
LuaParser/src/LuaParser.cpp
@@ -127,15 +127,21 @@ void LuaParser::BuildAstWithComment()
127
{
128
BuildAst();
129
130
- auto chunkChildren = _chunkAstNode->GetChildren();
+ auto& chunkChildren = _chunkAstNode->GetChildren();
131
+ auto& comments = _tokenParser->GetComments();
132
if (chunkChildren.empty())
133
- return;
134
+ if (comments.empty()) {
135
+ return;
136
+
137
+ }
138
+ auto block = CreateAstNode(LuaAstNodeType::Block);
139
+ chunkChildren.push_back(block);
140
}
141
142
auto blockNode = chunkChildren.front();
143
- auto& comments = _tokenParser->GetComments();
144
145
// 将注释注入AST中
146
if (!comments.empty())
147
0 commit comments