[Backport release-0.9] fix(languagetree): remove double recursion in LanguageTree:parse

`LanguageTree:parse` is recursive, and calls
`LanguageTree:for_each_child`, which is also recursive.

That means that, starting from the third level (child of child of root),
nodes will be parsed twice.

Which then means that if the tree is N layers deep, there will be ~2^N
parses even if the branching factor is 1.

Fixes: #25104
This commit is contained in:
L Lllvvuu
2023-09-12 00:19:43 -07:00
parent 51edadcaeb
commit 64160bac5b

View File

@@ -312,9 +312,9 @@ function LanguageTree:parse()
query_time = query_time, query_time = query_time,
}) })
self:for_each_child(function(child) for _, child in pairs(self._children) do
child:parse() child:parse()
end) end
self._valid = true self._valid = true