Skip to content

Commit

Permalink
Fix StackOverflow for extremely large lists
Browse files Browse the repository at this point in the history
Avoid using Array#insert which causes StackOverflow on large sets.

Fixes #1176
  • Loading branch information
lsegal committed Aug 9, 2018
1 parent 9589e74 commit 8a7befd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/yard/parser/ruby/ast_node.rb
Expand Up @@ -207,9 +207,10 @@ def children
# @return [void]
def traverse
nodes = [self]
nodes.each.with_index do |node, index|
until nodes.empty?
node = nodes.pop
yield node
nodes.insert index + 1, *node.children
nodes += node.children.reverse unless node.children.empty?
end
end

Expand Down

0 comments on commit 8a7befd

Please sign in to comment.