diff --git a/lib/yard-sorbet/node_utils.rb b/lib/yard-sorbet/node_utils.rb index 99fcff85..70a5df81 100644 --- a/lib/yard-sorbet/node_utils.rb +++ b/lib/yard-sorbet/node_utils.rb @@ -30,9 +30,9 @@ def self.bfs_traverse(node, &_blk) # Enqueue the eligible children of a node in the BFS queue sig { params(queue: Queue, node: YARD::Parser::Ruby::AstNode).void } def self.enque_children(queue, node) - num_children = node.children.size - node.children.each_with_index do |child, i| - next if i == num_children - 1 && + last_child = node.children.last + node.children.each do |child| + next if child == last_child && node.is_a?(YARD::Parser::Ruby::MethodCallNode) && SKIP_METHOD_CONTENTS.include?(node.method_name(true))