Sha256: 2ef93b0178757bbec7f1d53e9865eadeb5b738f7ba9703125d0950e6f86d8fca

Contents?: true

Size: 1.98 KB

Versions: 39

Compression:

Stored size: 1.98 KB

Contents

module RBS
  # Locator helps finding RBS elements based on locations in the RBS source text.
  #
  class Locator
    type component = Symbol
                   | Types::t
                   | MethodType
                   | AST::Declarations::t
                   | AST::Members::t
                   | AST::TypeParam
                   | AST::Declarations::Class::Super
                   | AST::Declarations::Module::Self
                   | AST::Directives::t
                   | AST::Directives::Use::clause

    # The buffer the location points to
    #
    attr_reader buffer: Buffer

    # Array of _top-level_ declarations.
    #
    attr_reader decls: Array[AST::Declarations::t]

    # Array of directives.
    #
    attr_reader dirs: Array[AST::Directives::t]

    def initialize: (buffer: Buffer, decls: Array[AST::Declarations::t], dirs: Array[AST::Directives::t]) -> void

    # Returns list of components.
    # Inner component comes first.
    #
    def find: (line: Integer, column: Integer) -> Array[component]

    # Returns pair of the inner most symbol and outer components.
    # It ensures the array starts with a AST/type component.
    #
    def find2: (line: Integer, column: Integer) -> [Symbol?, Array[component]]?

    private

    def find_in_directive: (Integer pos, AST::Directives::t, Array[component]) -> bool

    def find_in_decl: (Integer pos, decl: AST::Declarations::t, array: Array[component]) -> bool

    def find_in_member: (Integer pos, member: AST::Members::t, array: Array[component]) -> bool

    def find_in_method_type: (Integer pos, method_type: MethodType, array: Array[component]) -> bool

    def find_in_type: (Integer pos, type: Types::t, array: Array[component]) -> bool

    def find_in_type_param: (Integer pos, type_param: AST::TypeParam, array: Array[component]) -> bool

    def find_in_loc: (Integer pos, location: Location[untyped, untyped]?, array: Array[component]) -> bool

    def test_loc: (Integer pos, location: Location[untyped, untyped]?) -> bool
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
rbs-3.3.2 sig/locator.rbs
rbs-3.3.1 sig/locator.rbs
rbs-3.3.0 sig/locator.rbs
rbs-3.3.0.pre.2 sig/locator.rbs
rbs-3.3.0.pre.1 sig/locator.rbs
rbs-3.2.2 sig/locator.rbs
rbs-3.2.1 sig/locator.rbs
rbs-3.2.0 sig/locator.rbs
rbs-3.2.0.pre.1 sig/locator.rbs
rbs-3.1.3 sig/locator.rbs
rbs-3.1.2 sig/locator.rbs
rbs-3.1.1 sig/locator.rbs
rbs-3.1.0 sig/locator.rbs
rbs-3.0.4 sig/locator.rbs
rbs-3.0.3 sig/locator.rbs
rbs-3.0.2 sig/locator.rbs
rbs-3.0.1 sig/locator.rbs
rbs-3.0.0 sig/locator.rbs
rbs-3.0.0.dev.3 sig/locator.rbs