Sha256: 34af786bd8f916956b507e14ce57f39756270d27f1b97a6d1bfb2f0e23eebdfa

Contents?: true

Size: 966 Bytes

Versions: 31

Compression:

Stored size: 966 Bytes

Contents

module RBS
  module Resolver
    # TypeNameResolver resolves given relative type name to absolute type name under a module nesting context.
    #
    # The type name resolution doesn't take account of ancestors of modules.
    # It just ignores included modules and super classes.
    #
    class TypeNameResolver
      type query = [TypeName, context]

      def initialize: (Environment) -> void

      # Translates given type name to absolute type name.
      # Returns `nil` if cannot find associated type name.
      #
      def resolve: (TypeName, context: context) -> TypeName?

      private

      attr_reader env: Environment

      attr_reader all_names: Set[TypeName]

      attr_reader cache: Hash[query, TypeName?]

      def has_name?: (TypeName) -> TypeName?

      def try_cache: (query) { () -> TypeName? } -> TypeName?

      def resolve_in: (Symbol, context) -> TypeName?

      def partition: (TypeName) -> [Symbol, TypeName?]
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rbs-3.3.2 sig/resolver/type_name_resolver.rbs
rbs-3.3.1 sig/resolver/type_name_resolver.rbs
rbs-3.3.0 sig/resolver/type_name_resolver.rbs
rbs-3.3.0.pre.2 sig/resolver/type_name_resolver.rbs
rbs-3.3.0.pre.1 sig/resolver/type_name_resolver.rbs
rbs-3.2.2 sig/resolver/type_name_resolver.rbs
rbs-3.2.1 sig/resolver/type_name_resolver.rbs
rbs-3.2.0 sig/resolver/type_name_resolver.rbs
rbs-3.2.0.pre.1 sig/resolver/type_name_resolver.rbs
rbs-3.1.3 sig/resolver/type_name_resolver.rbs
rbs-3.1.2 sig/resolver/type_name_resolver.rbs