lib/tapioca/gem/pipeline.rb in tapioca-0.9.3 vs lib/tapioca/gem/pipeline.rb in tapioca-0.9.4

- old
+ new

@@ -11,12 +11,12 @@ IGNORED_SYMBOLS = T.let(["YAML", "MiniTest", "Mutex"], T::Array[String]) sig { returns(Gemfile::GemSpec) } attr_reader :gem - sig { params(gem: Gemfile::GemSpec, include_doc: T::Boolean).void } - def initialize(gem, include_doc: false) + sig { params(gem: Gemfile::GemSpec, include_doc: T::Boolean, include_loc: T::Boolean).void } + def initialize(gem, include_doc: false, include_loc: false) @root = T.let(RBI::Tree.new, RBI::Tree) @gem = gem @seen = T.let(Set.new, T::Set[String]) @alias_namespace = T.let(Set.new, T::Set[String]) @@ -38,10 +38,11 @@ @node_listeners << Gem::Listeners::SorbetRequiredAncestors.new(self) @node_listeners << Gem::Listeners::SorbetSignatures.new(self) @node_listeners << Gem::Listeners::Subconstants.new(self) @node_listeners << Gem::Listeners::YardDoc.new(self) if include_doc @node_listeners << Gem::Listeners::ForeignConstants.new(self) + @node_listeners << Gem::Listeners::SourceLocation.new(self) if include_loc @node_listeners << Gem::Listeners::RemoveEmptyPayloadScopes.new(self) end sig { returns(RBI::Tree) } def compile @@ -85,17 +86,18 @@ sig do params( symbol: String, constant: Module, + method: UnboundMethod, node: RBI::Method, signature: T.untyped, parameters: T::Array[[Symbol, String]] ).void.checked(:never) end - def push_method(symbol, constant, node, signature, parameters) - @events << Gem::MethodNodeAdded.new(symbol, constant, node, signature, parameters) + def push_method(symbol, constant, method, node, signature, parameters) # rubocop:disable Metrics/ParameterLists + @events << Gem::MethodNodeAdded.new(symbol, constant, method, node, signature, parameters) end sig { params(symbol_name: String).returns(T::Boolean) } def symbol_in_payload?(symbol_name) symbol_name = symbol_name[2..-1] if symbol_name.start_with?("::") @@ -351,10 +353,10 @@ sig { params(constant: Module).returns(T::Array[String]) } def get_file_candidates(constant) wrapped_module = Pry::WrappedModule.new(constant) - wrapped_module.candidates.map(&:file).to_a.compact + wrapped_module.send(:method_candidates).flatten.filter_map(&:source_file).uniq rescue ArgumentError, NameError [] end sig { params(name: String).void }