diff --git a/lib/ruby_indexer/lib/ruby_indexer/visitor.rb b/lib/ruby_indexer/lib/ruby_indexer/visitor.rb index 2c9fac50b..199f97c35 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/visitor.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/visitor.rb @@ -10,7 +10,7 @@ def initialize(index, parse_result, file_path) @index = index @file_path = file_path @stack = T.let([], T::Array[String]) - @singleton = T.let(false, T::Boolean) + @singleton_class = T.let(false, T::Boolean) @comments_by_line = T.let( parse_result.comments.to_h do |c| [c.location.start_line, c] @@ -28,9 +28,9 @@ def visit_class_node(node) sig { override.params(node: Prism::SingletonClassNode).void } def visit_singleton_class_node(node) - @singleton = true + @singleton_class = true super - @singleton = false + @singleton_class = false end sig { override.params(node: Prism::ModuleNode).void } @@ -134,7 +134,7 @@ def visit_def_node(node) comments = collect_comments(node) entry_class = case node.receiver when nil - if @singleton + if @singleton_class # i.e. `class << self` Entry::SingletonMethod else Entry::InstanceMethod