mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "Merge pull request #26937 from rintaro/syntaxparse-leakfix"
This reverts commite49401bbca, reversing changes made tobd222ad71c.
This commit is contained in:
@@ -256,9 +256,17 @@ ParsedRawSyntaxNode SyntaxParsingContext::finalizeSourceFile() {
|
||||
Layout[1] = std::move(Parts.back());
|
||||
Parts = Parts.drop_back();
|
||||
|
||||
assert(llvm::all_of(Parts, [](const ParsedRawSyntaxNode& node) {
|
||||
return node.getKind() == SyntaxKind::CodeBlockItem;
|
||||
}) && "all top level element must be 'CodeBlockItem'");
|
||||
for (auto RawNode : Parts) {
|
||||
if (RawNode.getKind() != SyntaxKind::CodeBlockItem) {
|
||||
// FIXME: Skip toplevel garbage nodes for now. we shouldn't emit them in
|
||||
// the first place.
|
||||
if (RawNode.isRecorded())
|
||||
getSyntaxCreator().finalizeNode(RawNode.getOpaqueNode());
|
||||
continue;
|
||||
}
|
||||
|
||||
AllTopLevel.push_back(RawNode);
|
||||
}
|
||||
|
||||
Layout[0] = Recorder.recordRawSyntax(SyntaxKind::CodeBlockItemList, Parts);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user