Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make module tracking lazy #1978

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions lib/ruby_indexer/lib/ruby_indexer/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,19 @@ class Namespace < Entry

abstract!

sig { returns(T::Array[String]) }
attr_accessor :included_modules
sig { returns(String) }
def short_name
T.must(@name.split("::").last)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be memoized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is actually dead #1980. Good catch!

end

sig { returns(T::Array[String]) }
attr_accessor :prepended_modules

sig do
params(
name: String,
file_path: String,
location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
).void
end
def initialize(name, file_path, location, comments)
super(name, file_path, location, comments)
@included_modules = T.let([], T::Array[String])
@prepended_modules = T.let([], T::Array[String])
def included_modules
@included_modules ||= T.let([], T.nilable(T::Array[String]))
end

sig { returns(String) }
def short_name
T.must(@name.split("::").last)
sig { returns(T::Array[String]) }
def prepended_modules
@prepended_modules ||= T.let([], T.nilable(T::Array[String]))
end
end

Expand Down
Loading