Sha256: 5454ef47cbbb6b63fe0a2e143f29b71b330e7969399b3f62728877f69e70ef08
Contents?: true
Size: 1.21 KB
Versions: 7
Compression:
Stored size: 1.21 KB
Contents
# typed: strict # frozen_string_literal: true module Tapioca module Gem module Listeners class Subconstants < Base extend T::Sig include Runtime::Reflection private sig { override.params(event: ScopeNodeAdded).void } def on_scope(event) symbol = event.symbol return if @pipeline.symbol_in_payload?(symbol) && event.node.empty? prefix = symbol == "Object" ? "" : symbol constant = event.constant constants_of(constant).sort.uniq.map do |constant_name| name = "#{prefix}::#{constant_name}" subconstant = constantize(name) # Don't compile modules of Object because Object::Foo == Foo # Don't compile modules of BasicObject because BasicObject::BasicObject == BasicObject next if (Object == constant || BasicObject == constant) && Module === subconstant next unless subconstant @pipeline.push_constant(name, subconstant) end end sig { override.params(event: NodeAdded).returns(T::Boolean) } def ignore?(event) event.is_a?(Tapioca::Gem::ForeignScopeNodeAdded) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems