Skip to content

Commit

Permalink
Add new visitor for Prism::ConstantPathNode
Browse files Browse the repository at this point in the history
  • Loading branch information
egiurleo committed May 13, 2024
1 parent b16c222 commit 4f69d45
Show file tree
Hide file tree
Showing 2 changed files with 4,867 additions and 3,934 deletions.
12 changes: 12 additions & 0 deletions lib/spoom/deadcode/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ def visit_constant_read_node(node)
reference_constant(node.name.to_s, node)
end

sig { override.params(node: Prism::ConstantPathNode).void }
def visit_constant_path_node(node)
# In prism 0.28.0, ConstantPathNode was updated to have no children
# and instead store the constant name as a string.
if node.respond_to?(:name)
visit(node.parent) if node.parent
reference_constant(node.name.to_s, node)
end

super
end

sig { override.params(node: Prism::ConstantWriteNode).void }
def visit_constant_write_node(node)
name = node.name.to_s
Expand Down
Loading

0 comments on commit 4f69d45

Please sign in to comment.