Sha256: a3162c100faeae89bf8811b3ec19dd1b712bc0ed5467cad7d1f0a41a4ec9e354

Contents?: true

Size: 876 Bytes

Versions: 28

Compression:

Stored size: 876 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 all_names: Set[TypeName]

      attr_reader cache: Hash[query, TypeName?]

      def has_name?: (TypeName) -> TypeName?

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

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

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
rbs-2.7.0.pre.1 sig/resolver/type_name_resolver.rbs
rbs-2.6.0 sig/resolver/type_name_resolver.rbs
rbs-2.5.1 sig/resolver/type_name_resolver.rbs
rbs-2.5.0 sig/resolver/type_name_resolver.rbs
rbs-2.4.0 sig/resolver/type_name_resolver.rbs
rbs-2.3.2 sig/resolver/type_name_resolver.rbs
rbs-2.3.1 sig/resolver/type_name_resolver.rbs
rbs-2.3.0 sig/resolver/type_name_resolver.rbs