You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

solargraph

Package Overview
Dependencies
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solargraph - rubygems Package Compare versions

Comparing version
0.58.1
to
0.58.2
+5
rbs/shims/ast/0/node.rbs
module ::AST
class Node
def children: () -> [self, Integer, String, Symbol, nil]
end
end
---
name: ast
version: '2.4'
source:
type: git
name: ruby/gem_rbs_collection
revision: c604d278dd6c14a1bb6cf0c0051af643b268a981
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
module AST
interface _ToAst
def to_ast: () -> Node
end
interface _ToSym
def to_sym: () -> Symbol
end
class Node
public
attr_reader children: Array[self]
attr_reader hash: String
attr_reader type: Symbol
alias + concat
alias << append
def ==: (untyped other) -> bool
def append: (untyped element) -> self
alias clone dup
def concat: (_ToA[untyped] array) -> self
def dup: () -> self
def eql?: (untyped other) -> bool
def inspect: (?Integer indent) -> String
alias to_a children
def to_ast: () -> self
alias to_s to_sexp
def to_sexp: (?Integer indent) -> String
def to_sexp_array: () -> Array[untyped]
def updated: (?_ToSym? `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped]? properties) -> self
private
def initialize: (_ToSym `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped] properties) -> void
alias original_dup dup
end
class Processor
include Mixin
module Mixin
public
def handler_missing: (Node node) -> Node?
def process: (_ToAst? node) -> Node?
def process_all: (Array[_ToAst] nodes) -> Array[Node]
end
end
module Sexp
public
def s: (_ToSym `type`, *untyped children) -> Node
end
end
# frozen_string_literal: true
module Parser
##
# Default AST builder. Uses {AST::Node}s.
#
module Builders
class Default
##
# AST compatibility attribute; since `-> {}` is not semantically
# equivalent to `lambda {}`, all new code should set this attribute
# to true.
#
# If set to false (the default), `-> {}` is emitted as
# `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
#
# If set to true, `-> {}` is emitted as
# `s(:block, s(:lambda), s(:args), nil)`.
#
# @return [Boolean]
attr_accessor self.emit_lambda: bool
##
# AST compatibility attribute; block arguments of `m { |a| }` are
# not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
# all new code should set this attribute to true.
#
# If set to false (the default), arguments of `m { |a| }` are emitted as
# `s(:args, s(:arg, :a))`.
#
# If set to true, arguments of `m { |a| }` are emitted as
# `s(:args, s(:procarg0, :a)).
#
# @return [Boolean]
attr_accessor self.emit_procarg0: bool
##
# AST compatibility attribute; locations of `__ENCODING__` are not the same
# as locations of `Encoding::UTF_8` causing problems during rewriting,
# all new code should set this attribute to true.
#
# If set to false (the default), `__ENCODING__` is emitted as
# ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
#
# If set to true, `__ENCODING__` is emitted as
# `s(:__ENCODING__)`.
#
# @return [Boolean]
attr_accessor self.emit_encoding: bool
##
# AST compatibility attribute; indexed assignment, `x[] = 1`, is not
# semantically equivalent to calling the method directly, `x.[]=(1)`.
# Specifically, in the former case, the expression's value is always 1,
# and in the latter case, the expression's value is the return value
# of the `[]=` method.
#
# If set to false (the default), `self[1]` is emitted as
# `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
# emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
#
# If set to true, `self[1]` is emitted as
# `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
# emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
#
# @return [Boolean]
attr_accessor self.emit_index: bool
##
# AST compatibility attribute; causes a single non-mlhs
# block argument to be wrapped in s(:procarg0).
#
# If set to false (the default), block arguments `|a|` are emitted as
# `s(:args, s(:procarg0, :a))`
#
# If set to true, block arguments `|a|` are emitted as
# `s(:args, s(:procarg0, s(:arg, :a))`
#
# @return [Boolean]
attr_accessor self.emit_arg_inside_procarg0: bool
##
# AST compatibility attribute; arguments forwarding initially
# didn't have support for leading arguments
# (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
# added support for any number of arguments in front of the `...`.
#
# If set to false (the default):
# 1. `def m(...) end` is emitted as
# s(:def, :m, s(:forward_args), nil)
# 2. `def m(a, b, ...) end` is emitted as
# s(:def, :m,
# s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
#
# If set to true it uses a single format:
# 1. `def m(...) end` is emitted as
# s(:def, :m, s(:args, s(:forward_arg)))
# 2. `def m(a, b, ...) end` is emitted as
# s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
#
# It does't matter that much on 2.7 (because there can't be any leading arguments),
# but on 3.0 it should be better enabled to use a single AST format.
#
# @return [Boolean]
attr_accessor self.emit_forward_arg: bool
##
# AST compatibility attribute; Starting from Ruby 2.7 keyword arguments
# of method calls that are passed explicitly as a hash (i.e. with curly braces)
# are treated as positional arguments and Ruby 2.7 emits a warning on such method
# call. Ruby 3.0 given an ArgumentError.
#
# If set to false (the default) the last hash argument is emitted as `hash`:
#
# ```
# (send nil :foo
# (hash
# (pair
# (sym :bar)
# (int 42))))
# ```
#
# If set to true it is emitted as `kwargs`:
#
# ```
# (send nil :foo
# (kwargs
# (pair
# (sym :bar)
# (int 42))))
# ```
#
# Note that `kwargs` node is just a replacement for `hash` argument,
# so if there's are multiple arguments (or a `kwsplat`) all of them
# are wrapped into `kwargs` instead of `hash`:
#
# ```
# (send nil :foo
# (kwargs
# (pair
# (sym :a)
# (int 42))
# (kwsplat
# (send nil :b))
# (pair
# (sym :c)
# (int 10))))
# ```
attr_accessor self.emit_kwargs: bool
##
# AST compatibility attribute; Starting from 3.0 Ruby returns
# true/false from single-line pattern matching with `in` keyword.
#
# Before 3.0 there was an exception if given value doesn't match pattern.
#
# NOTE: This attribute affects only Ruby 2.7 grammar.
# 3.0 grammar always emits `match_pattern`/`match_pattern_p`
#
# If compatibility attribute set to false `foo in bar` is emitted as `in_match`:
#
# ```
# (in-match
# (send nil :foo)
# (match-var :bar))
# ```
#
# If set to true it's emitted as `match_pattern_p`:
# ```
# (match-pattern-p
# (send nil :foo)
# (match-var :bar))
# ```
attr_accessor self.emit_match_pattern: bool
##
# If set to true (the default), `__FILE__` and `__LINE__` are transformed to
# literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
#
# If set to false, `__FILE__` and `__LINE__` are emitted as-is,
# i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
#
# Source maps are identical in both cases.
#
# @return [Boolean]
attr_accessor emit_file_line_as_literals: bool
def value: (untyped token) -> untyped
def string_value: (untyped token) -> String
def loc: (untyped token) -> untyped
end
end
end
# manifest.yaml describes dependencies which do not appear in the gemspec.
# If this gem includes such dependencies, comment-out the following lines and
# declare the dependencies.
# If all dependencies appear in the gemspec, you should remove this file.
#
dependencies:
- name: ast
module Parser
CurrentRuby: Parser::Base
class SyntaxError < StandardError
end
class UnknownEncodingInMagicComment < StandardError
end
class Base < Racc::Parser
def version: -> Integer
def self.parse: (String string, ?String file, ?Integer line) -> Parser::AST::Node?
def self.parse_with_comments: (String string, ?String file, ?Integer line) -> [Parser::AST::Node?, Array[Source::Comment]]
def parse: (Parser::Source::Buffer source_buffer) -> Parser::AST::Node?
end
class Ruby18 < Base
end
class Ruby19 < Base
end
class Ruby20 < Base
end
class Ruby21 < Base
end
class Ruby22 < Base
end
class Ruby23 < Base
end
class Ruby24 < Base
end
class Ruby25 < Base
end
class Ruby26 < Base
end
class Ruby27 < Base
end
class Ruby30 < Base
end
class Ruby31 < Base
end
class Ruby32 < Base
end
class Ruby33 < Base
end
module AST
class Node < ::AST::Node
attr_reader location: Source::Map
alias loc location
def children: () -> Array[self]
end
class Processor
module Mixin
def process: (Node? node) -> Node?
end
include Mixin
end
end
module Source
class Range
attr_reader source_buffer: Buffer
attr_reader begin_pos: Integer
attr_reader end_pos: Integer
def begin: () -> Range
def end: () -> Range
def size: () -> Integer
alias length size
def line: () -> Integer
alias first_line line
def column: () -> Integer
def last_line: () -> Integer
def last_column: () -> Integer
def column_range: () -> ::Range[Integer]
def source_line: () -> String
def source: () -> String
def with: (?begin_pos: Integer, ?end_pos: Integer) -> Range
def adjust: (?begin_pos: Integer, ?end_pos: Integer) -> Range
def resize: (Integer new_size) -> Range
def join: (Range other) -> Range
def intersect: (Range other) -> Range?
def disjoint?: (Range other) -> bool
def overlaps?: (Range other) -> bool
def contains?: (Range other) -> bool
def contained?: (Range other) -> bool
def crossing?: (Range other) -> bool
def empty?: () -> bool
end
##
# A buffer with source code. {Buffer} contains the source code itself,
# associated location information (name and first line), and takes care
# of encoding.
#
# A source buffer is immutable once populated.
#
# @!attribute [r] name
# Buffer name. If the buffer was created from a file, the name corresponds
# to relative path to the file.
# @return [String] buffer name
#
# @!attribute [r] first_line
# First line of the buffer, 1 by default.
# @return [Integer] first line
#
# @api public
#
class Buffer
attr_reader name: String
attr_reader first_line: Integer
def self.recognize_encoding: (String) -> Encoding
def self.reencode_string: (String) -> String
def initialize: (untyped name, ?Integer first_line, ?source: untyped) -> void
def read: () -> self
def source: () -> String
def source=: (String) -> String
def raw_source: (String) -> String
def decompose_position: (Integer) -> [Integer, Integer]
def source_lines: () -> Array[String]
def source_line: (Integer) -> String
def line_range: (Integer) -> ::Range[Integer]
def source_range: () -> ::Range[Integer]
def last_line: () -> Integer
end
class TreeRewriter
def replace: (Range range, String content) -> self
def remove: (Range range) -> self
def insert_before: (Range range, String content) -> self
def insert_after: (Range range, String content) -> self
end
class Map
attr_reader node: AST::Node | nil
attr_reader expression: Range
def line: () -> Integer
def first_line: () -> Integer
def last_line: () -> Integer
def column: () -> Integer
def last_column: () -> Integer
end
class Map::Collection < Map
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::Condition < Map
attr_reader keyword: Range
attr_reader begin: Range?
attr_reader else: Range?
attr_reader end: Range
end
class Map::Heredoc < Map
attr_reader heredoc_body: Range
attr_reader heredoc_end: Range
end
class Map::Keyword < Map
attr_reader keyword: Range
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::MethodDefinition < Map
attr_reader keyword: Range
attr_reader operator: Range?
attr_reader name: Range?
attr_reader end: Range?
attr_reader assignment: Range?
end
class Map::Operator < Map
attr_reader operator: Range?
end
class Map::Send < Map
attr_reader dot: Range?
attr_reader selector: Range
attr_reader operator: Range?
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::Ternary < Map
attr_reader question: Range?
attr_reader colon: Range
end
class Comment
attr_reader text: String
attr_reader location: Map
alias loc location
end
end
end
module Racc
class Parser
end
end
---
name: thor
version: '1.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: 98541aabafdf403b16ebae6fe4060d18bee75e93
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
# manifest.yaml describes dependencies which do not appear in the gemspec.
# If this gem includes such dependencies, comment-out the following lines and
# declare the dependencies.
# If all dependencies appear in the gemspec, you should remove this file.
#
# dependencies:
# - name: pathname
class Thor
class Group
end
module Actions
class CreateFile
end
def create_file: (String destination, String data, ?verbose: bool) -> String
| (String destination, ?verbose: bool) { () -> String } -> String
end
class Error
end
def self.start: (Array[String] given_args, ?Hash[Symbol, untyped] config) -> void
end
+1
-0

@@ -17,1 +17,2 @@ /.gem_rbs_collection

/.rspec-local
vendor/cache

@@ -0,3 +1,9 @@

## 0.58.2 - January 19, 2026
- Avoid rbs pollution (#1146)
- Fix 'solargraph pin --references ClassName' private method call (#1150)
- Improve memory efficiency of Position class (#1054)
- Raise InvalidOffsetError for offsets > text (#1155)
## 0.58.1 - January 2, 2026
- Normalize line endings to LF (#1142)
- Normalize line endings to LF (#1142)

@@ -4,0 +10,0 @@ ## 0.58.0 - January 1, 2026

@@ -0,0 +0,0 @@ # frozen_string_literal: true

+6
-6

@@ -714,2 +714,8 @@ # frozen_string_literal: true

# @param fq_sub_tag [String]
# @return [String, nil]
def qualify_superclass fq_sub_tag
store.qualify_superclass fq_sub_tag
end
private

@@ -808,8 +814,2 @@

# @param fq_sub_tag [String]
# @return [String, nil]
def qualify_superclass fq_sub_tag
store.qualify_superclass fq_sub_tag
end
# Get the namespace's type (Class or Module).

@@ -816,0 +816,0 @@ #

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ require 'ripper'

@@ -0,0 +0,0 @@ module Solargraph

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ module Solargraph

@@ -0,0 +0,0 @@ require 'yard-activesupport-concern'

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ module Solargraph

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ module Solargraph

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -61,4 +61,17 @@ # frozen_string_literal: true

return 0 if text.empty?
# @sg-ignore Unresolved call to + on Integer
text.lines[0...position.line].sum(&:length) + position.character
newline_index = -1
line = -1
last_line_index = 0
while (newline_index = text.index("\n", newline_index + 1)) && line <= position.line
line += 1
break if line == position.line
line_length = newline_index - last_line_index
last_line_index = newline_index
end
last_line_index += 1 if position.line > 0
last_line_index + position.character
end

@@ -79,2 +92,4 @@

#
# @raise [InvalidOffsetError] if the offset is outside the text range
#
# @param text [String]

@@ -84,14 +99,12 @@ # @param offset [Integer]

def self.from_offset text, offset
raise InvalidOffsetError if offset > text.length
cursor = 0
line = 0
character = nil
text.lines.each do |l|
line_length = l.length
char_length = l.chomp.length
if cursor + char_length >= offset
character = offset - cursor
break
end
cursor += line_length
character = offset
newline_index = -1
while (newline_index = text.index("\n", newline_index + 1)) && newline_index < offset
line += 1
character = offset - newline_index - 1
end

@@ -98,0 +111,0 @@ character = 0 if character.nil? and (cursor - offset).between?(0, 1)

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

# frozen_string_literal: true
module Solargraph
VERSION = '0.58.1'
VERSION = '0.58.2'
end

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ module Solargraph

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -0,0 +0,0 @@ # frozen_string_literal: true

@@ -5,3 +5,3 @@ # Download sources

name: shims
path: sig/shims
path: rbs/shims

@@ -8,0 +8,0 @@ - type: git

module ::AST
class Node
def children: () -> [self, Integer, String, Symbol, nil]
end
end
---
name: ast
version: '2.4'
source:
type: git
name: ruby/gem_rbs_collection
revision: c604d278dd6c14a1bb6cf0c0051af643b268a981
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
module AST
interface _ToAst
def to_ast: () -> Node
end
interface _ToSym
def to_sym: () -> Symbol
end
class Node
public
attr_reader children: Array[self]
attr_reader hash: String
attr_reader type: Symbol
alias + concat
alias << append
def ==: (untyped other) -> bool
def append: (untyped element) -> self
alias clone dup
def concat: (_ToA[untyped] array) -> self
def dup: () -> self
def eql?: (untyped other) -> bool
def inspect: (?Integer indent) -> String
alias to_a children
def to_ast: () -> self
alias to_s to_sexp
def to_sexp: (?Integer indent) -> String
def to_sexp_array: () -> Array[untyped]
def updated: (?_ToSym? `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped]? properties) -> self
private
def initialize: (_ToSym `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped] properties) -> void
alias original_dup dup
end
class Processor
include Mixin
module Mixin
public
def handler_missing: (Node node) -> Node?
def process: (_ToAst? node) -> Node?
def process_all: (Array[_ToAst] nodes) -> Array[Node]
end
end
module Sexp
public
def s: (_ToSym `type`, *untyped children) -> Node
end
end
# frozen_string_literal: true
module Parser
##
# Default AST builder. Uses {AST::Node}s.
#
module Builders
class Default
##
# AST compatibility attribute; since `-> {}` is not semantically
# equivalent to `lambda {}`, all new code should set this attribute
# to true.
#
# If set to false (the default), `-> {}` is emitted as
# `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
#
# If set to true, `-> {}` is emitted as
# `s(:block, s(:lambda), s(:args), nil)`.
#
# @return [Boolean]
attr_accessor self.emit_lambda: bool
##
# AST compatibility attribute; block arguments of `m { |a| }` are
# not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
# all new code should set this attribute to true.
#
# If set to false (the default), arguments of `m { |a| }` are emitted as
# `s(:args, s(:arg, :a))`.
#
# If set to true, arguments of `m { |a| }` are emitted as
# `s(:args, s(:procarg0, :a)).
#
# @return [Boolean]
attr_accessor self.emit_procarg0: bool
##
# AST compatibility attribute; locations of `__ENCODING__` are not the same
# as locations of `Encoding::UTF_8` causing problems during rewriting,
# all new code should set this attribute to true.
#
# If set to false (the default), `__ENCODING__` is emitted as
# ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
#
# If set to true, `__ENCODING__` is emitted as
# `s(:__ENCODING__)`.
#
# @return [Boolean]
attr_accessor self.emit_encoding: bool
##
# AST compatibility attribute; indexed assignment, `x[] = 1`, is not
# semantically equivalent to calling the method directly, `x.[]=(1)`.
# Specifically, in the former case, the expression's value is always 1,
# and in the latter case, the expression's value is the return value
# of the `[]=` method.
#
# If set to false (the default), `self[1]` is emitted as
# `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
# emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
#
# If set to true, `self[1]` is emitted as
# `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
# emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
#
# @return [Boolean]
attr_accessor self.emit_index: bool
##
# AST compatibility attribute; causes a single non-mlhs
# block argument to be wrapped in s(:procarg0).
#
# If set to false (the default), block arguments `|a|` are emitted as
# `s(:args, s(:procarg0, :a))`
#
# If set to true, block arguments `|a|` are emitted as
# `s(:args, s(:procarg0, s(:arg, :a))`
#
# @return [Boolean]
attr_accessor self.emit_arg_inside_procarg0: bool
##
# AST compatibility attribute; arguments forwarding initially
# didn't have support for leading arguments
# (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
# added support for any number of arguments in front of the `...`.
#
# If set to false (the default):
# 1. `def m(...) end` is emitted as
# s(:def, :m, s(:forward_args), nil)
# 2. `def m(a, b, ...) end` is emitted as
# s(:def, :m,
# s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
#
# If set to true it uses a single format:
# 1. `def m(...) end` is emitted as
# s(:def, :m, s(:args, s(:forward_arg)))
# 2. `def m(a, b, ...) end` is emitted as
# s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
#
# It does't matter that much on 2.7 (because there can't be any leading arguments),
# but on 3.0 it should be better enabled to use a single AST format.
#
# @return [Boolean]
attr_accessor self.emit_forward_arg: bool
##
# AST compatibility attribute; Starting from Ruby 2.7 keyword arguments
# of method calls that are passed explicitly as a hash (i.e. with curly braces)
# are treated as positional arguments and Ruby 2.7 emits a warning on such method
# call. Ruby 3.0 given an ArgumentError.
#
# If set to false (the default) the last hash argument is emitted as `hash`:
#
# ```
# (send nil :foo
# (hash
# (pair
# (sym :bar)
# (int 42))))
# ```
#
# If set to true it is emitted as `kwargs`:
#
# ```
# (send nil :foo
# (kwargs
# (pair
# (sym :bar)
# (int 42))))
# ```
#
# Note that `kwargs` node is just a replacement for `hash` argument,
# so if there's are multiple arguments (or a `kwsplat`) all of them
# are wrapped into `kwargs` instead of `hash`:
#
# ```
# (send nil :foo
# (kwargs
# (pair
# (sym :a)
# (int 42))
# (kwsplat
# (send nil :b))
# (pair
# (sym :c)
# (int 10))))
# ```
attr_accessor self.emit_kwargs: bool
##
# AST compatibility attribute; Starting from 3.0 Ruby returns
# true/false from single-line pattern matching with `in` keyword.
#
# Before 3.0 there was an exception if given value doesn't match pattern.
#
# NOTE: This attribute affects only Ruby 2.7 grammar.
# 3.0 grammar always emits `match_pattern`/`match_pattern_p`
#
# If compatibility attribute set to false `foo in bar` is emitted as `in_match`:
#
# ```
# (in-match
# (send nil :foo)
# (match-var :bar))
# ```
#
# If set to true it's emitted as `match_pattern_p`:
# ```
# (match-pattern-p
# (send nil :foo)
# (match-var :bar))
# ```
attr_accessor self.emit_match_pattern: bool
##
# If set to true (the default), `__FILE__` and `__LINE__` are transformed to
# literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
#
# If set to false, `__FILE__` and `__LINE__` are emitted as-is,
# i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
#
# Source maps are identical in both cases.
#
# @return [Boolean]
attr_accessor emit_file_line_as_literals: bool
def value: (untyped token) -> untyped
def string_value: (untyped token) -> String
def loc: (untyped token) -> untyped
end
end
end
# manifest.yaml describes dependencies which do not appear in the gemspec.
# If this gem includes such dependencies, comment-out the following lines and
# declare the dependencies.
# If all dependencies appear in the gemspec, you should remove this file.
#
dependencies:
- name: ast
module Parser
CurrentRuby: Parser::Base
class SyntaxError < StandardError
end
class UnknownEncodingInMagicComment < StandardError
end
class Base < Racc::Parser
def version: -> Integer
def self.parse: (String string, ?String file, ?Integer line) -> Parser::AST::Node?
def self.parse_with_comments: (String string, ?String file, ?Integer line) -> [Parser::AST::Node?, Array[Source::Comment]]
def parse: (Parser::Source::Buffer source_buffer) -> Parser::AST::Node?
end
class Ruby18 < Base
end
class Ruby19 < Base
end
class Ruby20 < Base
end
class Ruby21 < Base
end
class Ruby22 < Base
end
class Ruby23 < Base
end
class Ruby24 < Base
end
class Ruby25 < Base
end
class Ruby26 < Base
end
class Ruby27 < Base
end
class Ruby30 < Base
end
class Ruby31 < Base
end
class Ruby32 < Base
end
class Ruby33 < Base
end
module AST
class Node < ::AST::Node
attr_reader location: Source::Map
alias loc location
def children: () -> Array[self]
end
class Processor
module Mixin
def process: (Node? node) -> Node?
end
include Mixin
end
end
module Source
class Range
attr_reader source_buffer: Buffer
attr_reader begin_pos: Integer
attr_reader end_pos: Integer
def begin: () -> Range
def end: () -> Range
def size: () -> Integer
alias length size
def line: () -> Integer
alias first_line line
def column: () -> Integer
def last_line: () -> Integer
def last_column: () -> Integer
def column_range: () -> ::Range[Integer]
def source_line: () -> String
def source: () -> String
def with: (?begin_pos: Integer, ?end_pos: Integer) -> Range
def adjust: (?begin_pos: Integer, ?end_pos: Integer) -> Range
def resize: (Integer new_size) -> Range
def join: (Range other) -> Range
def intersect: (Range other) -> Range?
def disjoint?: (Range other) -> bool
def overlaps?: (Range other) -> bool
def contains?: (Range other) -> bool
def contained?: (Range other) -> bool
def crossing?: (Range other) -> bool
def empty?: () -> bool
end
##
# A buffer with source code. {Buffer} contains the source code itself,
# associated location information (name and first line), and takes care
# of encoding.
#
# A source buffer is immutable once populated.
#
# @!attribute [r] name
# Buffer name. If the buffer was created from a file, the name corresponds
# to relative path to the file.
# @return [String] buffer name
#
# @!attribute [r] first_line
# First line of the buffer, 1 by default.
# @return [Integer] first line
#
# @api public
#
class Buffer
attr_reader name: String
attr_reader first_line: Integer
def self.recognize_encoding: (String) -> Encoding
def self.reencode_string: (String) -> String
def initialize: (untyped name, ?Integer first_line, ?source: untyped) -> void
def read: () -> self
def source: () -> String
def source=: (String) -> String
def raw_source: (String) -> String
def decompose_position: (Integer) -> [Integer, Integer]
def source_lines: () -> Array[String]
def source_line: (Integer) -> String
def line_range: (Integer) -> ::Range[Integer]
def source_range: () -> ::Range[Integer]
def last_line: () -> Integer
end
class TreeRewriter
def replace: (Range range, String content) -> self
def remove: (Range range) -> self
def insert_before: (Range range, String content) -> self
def insert_after: (Range range, String content) -> self
end
class Map
attr_reader node: AST::Node | nil
attr_reader expression: Range
def line: () -> Integer
def first_line: () -> Integer
def last_line: () -> Integer
def column: () -> Integer
def last_column: () -> Integer
end
class Map::Collection < Map
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::Condition < Map
attr_reader keyword: Range
attr_reader begin: Range?
attr_reader else: Range?
attr_reader end: Range
end
class Map::Heredoc < Map
attr_reader heredoc_body: Range
attr_reader heredoc_end: Range
end
class Map::Keyword < Map
attr_reader keyword: Range
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::MethodDefinition < Map
attr_reader keyword: Range
attr_reader operator: Range?
attr_reader name: Range?
attr_reader end: Range?
attr_reader assignment: Range?
end
class Map::Operator < Map
attr_reader operator: Range?
end
class Map::Send < Map
attr_reader dot: Range?
attr_reader selector: Range
attr_reader operator: Range?
attr_reader begin: Range?
attr_reader end: Range?
end
class Map::Ternary < Map
attr_reader question: Range?
attr_reader colon: Range
end
class Comment
attr_reader text: String
attr_reader location: Map
alias loc location
end
end
end
module Racc
class Parser
end
end
---
name: thor
version: '1.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: 98541aabafdf403b16ebae6fe4060d18bee75e93
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
# manifest.yaml describes dependencies which do not appear in the gemspec.
# If this gem includes such dependencies, comment-out the following lines and
# declare the dependencies.
# If all dependencies appear in the gemspec, you should remove this file.
#
# dependencies:
# - name: pathname
class Thor
class Group
end
module Actions
class CreateFile
end
def create_file: (String destination, String data, ?verbose: bool) -> String
| (String destination, ?verbose: bool) { () -> String } -> String
end
class Error
end
def self.start: (Array[String] given_args, ?Hash[Symbol, untyped] config) -> void
end