Sha256: 2c7d63e77e1ef86cd5aad308edfb18994158ebab4621f4cc31ca5a3a3b2ebe92

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Tapioca
  module Gem
    module Listeners
      class SorbetRequiredAncestors < Base
        extend T::Sig

        private

        sig { override.params(event: ScopeNodeAdded).void }
        def on_scope(event)
          ancestors = Runtime::Trackers::RequiredAncestor.required_ancestors_by(event.constant)
          ancestors.each do |ancestor|
            next unless ancestor # TODO: We should have a way to warn from here

            event.node << RBI::RequiresAncestor.new(ancestor.to_s)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tapioca-0.8.3 lib/tapioca/gem/listeners/sorbet_required_ancestors.rb
tapioca-0.8.2 lib/tapioca/gem/listeners/sorbet_required_ancestors.rb
tapioca-0.8.1 lib/tapioca/gem/listeners/sorbet_required_ancestors.rb
tapioca-0.8.0 lib/tapioca/gem/listeners/sorbet_required_ancestors.rb