Skip to content

Commit

Permalink
Rename ivar
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Oct 17, 2023
1 parent 9350f23 commit 5fa5394
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ruby_indexer/lib/ruby_indexer/visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 }
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5fa5394

Please sign in to comment.