diff --git a/Gemfile.lock b/Gemfile.lock index c90f398ee..5daeb4491 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ PATH constant_resolver (>= 0.3) parallel parser - prism (>= 0.25.0) + prism (>= 1.4.0) sorbet-runtime (>= 0.5.9914) zeitwerk (>= 2.6.1) @@ -106,7 +106,7 @@ GEM pp (0.6.2) prettyprint prettyprint (0.2.0) - prism (0.27.0) + prism (1.6.0) psych (5.2.6) date stringio @@ -136,9 +136,11 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rbi (0.1.12) - prism (>= 0.18.0, < 0.28) - sorbet-runtime (>= 0.5.9204) + rbi (0.3.7) + prism (~> 1.0) + rbs (>= 3.4.4) + rbs (3.9.5) + logger rdoc (6.14.0) erb psych (>= 4.0.0) @@ -186,11 +188,12 @@ GEM thor (>= 0.19.2) spring (4.0.0) stringio (3.1.7) - tapioca (0.13.3) + tapioca (0.16.11) + benchmark bundler (>= 2.2.25) netrc (>= 0.11.0) parallel (>= 1.21.0) - rbi (>= 0.1.4, < 0.2) + rbi (~> 0.2) sorbet-static-and-runtime (>= 0.5.11087) spoom (>= 1.2.0) thor (>= 1.2.0) diff --git a/lib/packwerk/parsers/ruby.rb b/lib/packwerk/parsers/ruby.rb index 937431b40..705fa0f16 100644 --- a/lib/packwerk/parsers/ruby.rb +++ b/lib/packwerk/parsers/ruby.rb @@ -28,7 +28,7 @@ def valid_error?(error) end end - class TolerateInvalidUtf8Builder < Parser::Builders::Default + class TolerateInvalidUtf8Builder < Prism::Translation::Parser::Builder extend T::Sig sig { params(token: T.untyped).returns(T.untyped) } diff --git a/packwerk.gemspec b/packwerk.gemspec index 82e0c10b8..c57066b3b 100644 --- a/packwerk.gemspec +++ b/packwerk.gemspec @@ -48,7 +48,7 @@ Gem::Specification.new do |spec| # For Ruby parsing spec.add_dependency("ast") spec.add_dependency("parser") - spec.add_dependency("prism", ">= 0.25.0") + spec.add_dependency("prism", ">= 1.4.0") # For ERB parsing spec.add_dependency("better_html") diff --git a/sorbet/rbi/gems/prism@0.27.0.rbi b/sorbet/rbi/gems/prism@1.4.0.rbi similarity index 53% rename from sorbet/rbi/gems/prism@0.27.0.rbi rename to sorbet/rbi/gems/prism@1.4.0.rbi index 36267480b..5a92b9dd4 100644 --- a/sorbet/rbi/gems/prism@0.27.0.rbi +++ b/sorbet/rbi/gems/prism@1.4.0.rbi @@ -4,8 +4,14 @@ # This is an autogenerated file for types exported from the `prism` gem. # Please instead update this file by running `bin/tapioca gem prism`. + # typed: strict +# =begin +# This file is generated by the templates/template.rb script and should not be +# modified manually. See templates/rbi/prism/dsl.rbi.erb +# if you are looking to modify the template +# =end # =begin # This file is generated by the templates/template.rb script and should not be # modified manually. See templates/rbi/prism/node.rbi.erb @@ -17,18 +23,10 @@ # if you are looking to modify the template # =end -# We keep these shims in here because our client libraries might not have -# ast/parser in their bundle. -module AST; end - -class AST::Node; end - # We keep these shims in here because our client libraries might not have parser # in their bundle. module Parser; end -module Parser::AST; end -class Parser::AST::Node < AST::Node; end class Parser::Base; end # The Prism Ruby parser. @@ -76,13 +74,13 @@ module Prism def lex_ripper(source); end # :call-seq: - # Prism::load(source, serialized) -> ParseResult + # Prism::load(source, serialized, freeze) -> ParseResult # # Load the serialized AST using the source as a reference into a tree. # # source://prism//lib/prism.rb#65 - sig { params(source: String, serialized: String).returns(Prism::ParseResult) } - def load(source, serialized); end + sig { params(source: String, serialized: String, freeze: T.nilable(T::Boolean)).returns(Prism::ParseResult) } + def load(source, serialized, freeze = T.unsafe(nil)); end # Mirror the Prism.parse API by using the serialization API. def parse(*_arg0); end @@ -128,7 +126,76 @@ module Prism # # @return [Boolean] def parse_success?(*_arg0); end + + # Mirror the Prism.profile API by using the serialization API. + def profile(*_arg0); end + + # Mirror the Prism.profile_file API by using the serialization API. + def profile_file(*_arg0); end + + # Create a new scope with the given locals and forwarding options that is + # suitable for passing into one of the Prism.* methods that accepts the + # `scopes` option. + # + # source://prism//lib/prism/parse_result.rb#907 + sig { params(locals: T::Array[Symbol], forwarding: T::Array[Symbol]).returns(Prism::Scope) } + def scope(locals: T.unsafe(nil), forwarding: T.unsafe(nil)); end + end +end + +# Specialized version of Prism::Source for source code that includes ASCII +# characters only. This class is used to apply performance optimizations that +# cannot be applied to sources that include multibyte characters. +# +# In the extremely rare case that a source includes multi-byte characters but +# is marked as binary because of a magic encoding comment and it cannot be +# eagerly converted to UTF-8, this class will be used as well. This is because +# at that point we will treat everything as single-byte characters. +# +# source://prism//lib/prism/parse_result.rb#253 +class Prism::ASCIISource < ::Prism::Source + # Return the column number in characters for the given byte offset. + # + # source://prism//lib/prism/parse_result.rb#260 + sig { params(byte_offset: Integer).returns(Integer) } + def character_column(byte_offset); end + + # Return the character offset for the given byte offset. + # + # source://prism//lib/prism/parse_result.rb#255 + sig { params(byte_offset: Integer).returns(Integer) } + def character_offset(byte_offset); end + + # Returns a cache that is the identity function in order to maintain the + # same interface. We can do this because code units are always equivalent to + # byte offsets for ASCII-only sources. + # + # source://prism//lib/prism/parse_result.rb#277 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) end + def code_units_cache(encoding); end + + # Specialized version of `code_units_column` that does not depend on + # `code_units_offset`, which is a more expensive operation. This is + # essentially the same as `Prism::Source#column`. + # + # source://prism//lib/prism/parse_result.rb#284 + sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } + def code_units_column(byte_offset, encoding); end + + # Returns the offset from the start of the file for the given byte offset + # counting in code units for the given encoding. + # + # This method is tested with UTF-8, UTF-16, and UTF-32. If there is the + # concept of code units that differs from the number of characters in other + # encodings, it is not captured here. + # + # source://prism//lib/prism/parse_result.rb#270 + sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } + def code_units_offset(byte_offset, encoding); end end # Represents the use of the `alias` keyword to alias a global variable. @@ -136,92 +203,96 @@ end # alias $foo $bar # ^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#135 +# source://prism//lib/prism/node.rb#316 class Prism::AliasGlobalVariableNode < ::Prism::Node - # def initialize: (Prism::node new_name, Prism::node old_name, Location keyword_loc, Location location) -> void + # Initialize a new AliasGlobalVariableNode node. # # @return [AliasGlobalVariableNode] a new instance of AliasGlobalVariableNode # - # source://prism//lib/prism/node.rb#137 + # source://prism//lib/prism/node.rb#318 sig do params( source: Prism::Source, - new_name: Prism::Node, - old_name: Prism::Node, - keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode), + old_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode), + keyword_loc: Prism::Location ).void end - def initialize(source, new_name, old_name, keyword_loc, location); end + def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#247 + # source://prism//lib/prism/node.rb#411 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#147 + # source://prism//lib/prism/node.rb#329 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#152 + # source://prism//lib/prism/node.rb#334 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#162 + # source://prism//lib/prism/node.rb#344 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#157 + # source://prism//lib/prism/node.rb#339 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?new_name: Prism::node, ?old_name: Prism::node, ?keyword_loc: Location, ?location: Location) -> AliasGlobalVariableNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | SymbolNode | MissingNode, ?keyword_loc: Location) -> AliasGlobalVariableNode # - # source://prism//lib/prism/node.rb#167 + # source://prism//lib/prism/node.rb#349 sig do params( - new_name: Prism::Node, - old_name: Prism::Node, - keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode), + old_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode), + keyword_loc: Prism::Location ).returns(Prism::AliasGlobalVariableNode) end - def copy(new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#152 + # source://prism//lib/prism/node.rb#334 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { new_name: Prism::node, old_name: Prism::node, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | SymbolNode | MissingNode, keyword_loc: Location } # - # source://prism//lib/prism/node.rb#175 + # source://prism//lib/prism/node.rb#357 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#207 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#395 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#202 + # source://prism//lib/prism/node.rb#390 sig { returns(String) } def keyword; end @@ -230,56 +301,46 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # alias $foo $bar # ^^^^^ # - # source://prism//lib/prism/node.rb#195 + # source://prism//lib/prism/node.rb#377 sig { returns(Prism::Location) } def keyword_loc; end - # Represents the new name of the global variable that can be used after aliasing. This can be either a global variable, a back reference, or a numbered reference. + # Represents the new name of the global variable that can be used after aliasing. # # alias $foo $bar # ^^^^ # - # source://prism//lib/prism/node.rb#183 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#365 + sig { returns(T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)) } def new_name; end - # Represents the old name of the global variable that could be used before aliasing. This can be either a global variable, a back reference, or a numbered reference. + # Represents the old name of the global variable that can be used before aliasing. # # alias $foo $bar # ^^^^ # - # source://prism//lib/prism/node.rb#189 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#371 + sig do + returns(T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode)) + end def old_name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#385 + def save_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#231 + # source://prism//lib/prism/node.rb#400 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#241 + # source://prism//lib/prism/node.rb#405 def type; end end end @@ -289,141 +350,156 @@ end # alias foo bar # ^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#259 +# source://prism//lib/prism/node.rb#423 class Prism::AliasMethodNode < ::Prism::Node - # def initialize: (Prism::node new_name, Prism::node old_name, Location keyword_loc, Location location) -> void + # Initialize a new AliasMethodNode node. # # @return [AliasMethodNode] a new instance of AliasMethodNode # - # source://prism//lib/prism/node.rb#261 + # source://prism//lib/prism/node.rb#425 sig do params( source: Prism::Source, - new_name: Prism::Node, - old_name: Prism::Node, - keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode), + old_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode), + keyword_loc: Prism::Location ).void end - def initialize(source, new_name, old_name, keyword_loc, location); end + def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#362 + # source://prism//lib/prism/node.rb#530 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#271 + # source://prism//lib/prism/node.rb#436 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#276 + # source://prism//lib/prism/node.rb#441 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#286 + # source://prism//lib/prism/node.rb#451 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#281 + # source://prism//lib/prism/node.rb#446 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?new_name: Prism::node, ?old_name: Prism::node, ?keyword_loc: Location, ?location: Location) -> AliasMethodNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: SymbolNode | InterpolatedSymbolNode, ?old_name: SymbolNode | InterpolatedSymbolNode | GlobalVariableReadNode | MissingNode, ?keyword_loc: Location) -> AliasMethodNode # - # source://prism//lib/prism/node.rb#291 + # source://prism//lib/prism/node.rb#456 sig do params( - new_name: Prism::Node, - old_name: Prism::Node, - keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode), + old_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode), + keyword_loc: Prism::Location ).returns(Prism::AliasMethodNode) end - def copy(new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#276 + # source://prism//lib/prism/node.rb#441 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { new_name: Prism::node, old_name: Prism::node, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, new_name: SymbolNode | InterpolatedSymbolNode, old_name: SymbolNode | InterpolatedSymbolNode | GlobalVariableReadNode | MissingNode, keyword_loc: Location } # - # source://prism//lib/prism/node.rb#299 + # source://prism//lib/prism/node.rb#464 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#322 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#514 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#317 + # source://prism//lib/prism/node.rb#509 sig { returns(String) } def keyword; end - # attr_reader keyword_loc: Location + # Represents the location of the `alias` keyword. + # + # alias foo bar + # ^^^^^ # - # source://prism//lib/prism/node.rb#310 + # source://prism//lib/prism/node.rb#496 sig { returns(Prism::Location) } def keyword_loc; end - # attr_reader new_name: Prism::node + # Represents the new name of the method that will be aliased. # - # source://prism//lib/prism/node.rb#304 - sig { returns(Prism::Node) } + # alias foo bar + # ^^^ + # + # alias :foo :bar + # ^^^^ + # + # alias :"#{foo}" :"#{bar}" + # ^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#478 + sig { returns(T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)) } def new_name; end - # attr_reader old_name: Prism::node + # Represents the old name of the method that will be aliased. # - # source://prism//lib/prism/node.rb#307 - sig { returns(Prism::Node) } + # alias foo bar + # ^^^ + # + # alias :foo :bar + # ^^^^ + # + # alias :"#{foo}" :"#{bar}" + # ^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#490 + sig do + returns(T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode)) + end def old_name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#504 + def save_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#346 + # source://prism//lib/prism/node.rb#519 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#356 + # source://prism//lib/prism/node.rb#524 def type; end end end @@ -433,141 +509,142 @@ end # foo => bar | baz # ^^^^^^^^^ # -# source://prism//lib/prism/node.rb#374 +# source://prism//lib/prism/node.rb#542 class Prism::AlternationPatternNode < ::Prism::Node - # def initialize: (Prism::node left, Prism::node right, Location operator_loc, Location location) -> void + # Initialize a new AlternationPatternNode node. # # @return [AlternationPatternNode] a new instance of AlternationPatternNode # - # source://prism//lib/prism/node.rb#376 + # source://prism//lib/prism/node.rb#544 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, left: Prism::Node, right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, left, right, operator_loc, location); end + def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#477 + # source://prism//lib/prism/node.rb#637 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#386 + # source://prism//lib/prism/node.rb#555 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#391 + # source://prism//lib/prism/node.rb#560 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#401 + # source://prism//lib/prism/node.rb#570 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#396 + # source://prism//lib/prism/node.rb#565 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?left: Prism::node, ?right: Prism::node, ?operator_loc: Location, ?location: Location) -> AlternationPatternNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode # - # source://prism//lib/prism/node.rb#406 + # source://prism//lib/prism/node.rb#575 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, left: Prism::Node, right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::AlternationPatternNode) end - def copy(left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#391 + # source://prism//lib/prism/node.rb#560 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { left: Prism::node, right: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#414 + # source://prism//lib/prism/node.rb#583 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#437 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#621 + sig { override.returns(String) } + def inspect; end - # attr_reader left: Prism::node + # Represents the left side of the expression. + # + # foo => bar | baz + # ^^^ # - # source://prism//lib/prism/node.rb#419 + # source://prism//lib/prism/node.rb#591 sig { returns(Prism::Node) } def left; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#432 + # source://prism//lib/prism/node.rb#616 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the alternation operator location. # - # source://prism//lib/prism/node.rb#425 + # foo => bar | baz + # ^ + # + # source://prism//lib/prism/node.rb#603 sig { returns(Prism::Location) } def operator_loc; end - # attr_reader right: Prism::node + # Represents the right side of the expression. + # + # foo => bar | baz + # ^^^ # - # source://prism//lib/prism/node.rb#422 + # source://prism//lib/prism/node.rb#597 sig { returns(Prism::Node) } def right; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#611 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#461 + # source://prism//lib/prism/node.rb#626 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#471 + # source://prism//lib/prism/node.rb#631 def type; end end end @@ -577,88 +654,92 @@ end # left and right # ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#489 +# source://prism//lib/prism/node.rb#649 class Prism::AndNode < ::Prism::Node - # def initialize: (Prism::node left, Prism::node right, Location operator_loc, Location location) -> void + # Initialize a new AndNode node. # # @return [AndNode] a new instance of AndNode # - # source://prism//lib/prism/node.rb#491 + # source://prism//lib/prism/node.rb#651 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, left: Prism::Node, right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, left, right, operator_loc, location); end + def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#607 + # source://prism//lib/prism/node.rb#750 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#501 + # source://prism//lib/prism/node.rb#662 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#506 + # source://prism//lib/prism/node.rb#667 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#516 + # source://prism//lib/prism/node.rb#677 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#511 + # source://prism//lib/prism/node.rb#672 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?left: Prism::node, ?right: Prism::node, ?operator_loc: Location, ?location: Location) -> AndNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode # - # source://prism//lib/prism/node.rb#521 + # source://prism//lib/prism/node.rb#682 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, left: Prism::Node, right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::AndNode) end - def copy(left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#506 + # source://prism//lib/prism/node.rb#667 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { left: Prism::node, right: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#529 + # source://prism//lib/prism/node.rb#690 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#567 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#734 + sig { override.returns(String) } + def inspect; end # Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # @@ -668,13 +749,13 @@ class Prism::AndNode < ::Prism::Node # 1 && 2 # ^ # - # source://prism//lib/prism/node.rb#540 + # source://prism//lib/prism/node.rb#701 sig { returns(Prism::Node) } def left; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#562 + # source://prism//lib/prism/node.rb#729 sig { returns(String) } def operator; end @@ -683,11 +764,11 @@ class Prism::AndNode < ::Prism::Node # left and right # ^^^ # - # source://prism//lib/prism/node.rb#555 + # source://prism//lib/prism/node.rb#716 sig { returns(Prism::Location) } def operator_loc; end - # Represents the right side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # Represents the right side of the expression. # # left && right # ^^^^^ @@ -695,38 +776,26 @@ class Prism::AndNode < ::Prism::Node # 1 and 2 # ^ # - # source://prism//lib/prism/node.rb#549 + # source://prism//lib/prism/node.rb#710 sig { returns(Prism::Node) } def right; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#724 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#591 + # source://prism//lib/prism/node.rb#739 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#601 + # source://prism//lib/prism/node.rb#744 def type; end end end @@ -736,196 +805,228 @@ end # return foo, bar, baz # ^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#619 +# source://prism//lib/prism/node.rb#762 class Prism::ArgumentsNode < ::Prism::Node - # def initialize: (Integer flags, Array[Prism::node] arguments, Location location) -> void + # Initialize a new ArgumentsNode node. # # @return [ArgumentsNode] a new instance of ArgumentsNode # - # source://prism//lib/prism/node.rb#621 + # source://prism//lib/prism/node.rb#764 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - arguments: T::Array[Prism::Node], - location: Prism::Location + arguments: T::Array[Prism::Node] ).void end - def initialize(source, flags, arguments, location); end + def initialize(source, node_id, location, flags, arguments); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#713 + # source://prism//lib/prism/node.rb#853 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#630 + # source://prism//lib/prism/node.rb#773 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader arguments: Array[Prism::node] + # The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#667 + # foo(bar, baz) + # ^^^^^^^^ + # + # source://prism//lib/prism/node.rb#834 sig { returns(T::Array[Prism::Node]) } def arguments; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#635 + # source://prism//lib/prism/node.rb#778 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#645 + # source://prism//lib/prism/node.rb#788 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#640 + # source://prism//lib/prism/node.rb#783 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end + # def contains_forwarding?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#806 + sig { returns(T::Boolean) } + def contains_forwarding?; end + # def contains_keyword_splat?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#670 + # source://prism//lib/prism/node.rb#816 sig { returns(T::Boolean) } def contains_keyword_splat?; end - # def copy: (?flags: Integer, ?arguments: Array[Prism::node], ?location: Location) -> ArgumentsNode + # def contains_keywords?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#811 + sig { returns(T::Boolean) } + def contains_keywords?; end + + # def contains_multiple_splats?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#826 + sig { returns(T::Boolean) } + def contains_multiple_splats?; end + + # def contains_splat?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#821 + sig { returns(T::Boolean) } + def contains_splat?; end + + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: Array[Prism::node]) -> ArgumentsNode # - # source://prism//lib/prism/node.rb#650 + # source://prism//lib/prism/node.rb#793 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - arguments: T::Array[Prism::Node], - location: Prism::Location + arguments: T::Array[Prism::Node] ).returns(Prism::ArgumentsNode) end - def copy(flags: T.unsafe(nil), arguments: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#635 + # source://prism//lib/prism/node.rb#778 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, arguments: Array[Prism::node], location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, arguments: Array[Prism::node] } # - # source://prism//lib/prism/node.rb#658 + # source://prism//lib/prism/node.rb#801 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#675 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#837 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#697 + # source://prism//lib/prism/node.rb#842 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#663 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#707 + # source://prism//lib/prism/node.rb#847 def type; end end end # Flags for arguments nodes. # -# source://prism//lib/prism/node.rb#20337 +# source://prism//lib/prism/node.rb#18459 module Prism::ArgumentsNodeFlags; end -# if arguments contain keyword splat +# if the arguments contain forwarding +# +# source://prism//lib/prism/node.rb#18461 +Prism::ArgumentsNodeFlags::CONTAINS_FORWARDING = T.let(T.unsafe(nil), Integer) + +# if the arguments contain keywords +# +# source://prism//lib/prism/node.rb#18464 +Prism::ArgumentsNodeFlags::CONTAINS_KEYWORDS = T.let(T.unsafe(nil), Integer) + +# if the arguments contain a keyword splat # -# source://prism//lib/prism/node.rb#20339 +# source://prism//lib/prism/node.rb#18467 Prism::ArgumentsNodeFlags::CONTAINS_KEYWORD_SPLAT = T.let(T.unsafe(nil), Integer) +# if the arguments contain multiple splats +# +# source://prism//lib/prism/node.rb#18473 +Prism::ArgumentsNodeFlags::CONTAINS_MULTIPLE_SPLATS = T.let(T.unsafe(nil), Integer) + +# if the arguments contain a splat +# +# source://prism//lib/prism/node.rb#18470 +Prism::ArgumentsNodeFlags::CONTAINS_SPLAT = T.let(T.unsafe(nil), Integer) + # Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i. # # [1, 2, 3] # ^^^^^^^^^ # -# source://prism//lib/prism/node.rb#725 +# source://prism//lib/prism/node.rb#865 class Prism::ArrayNode < ::Prism::Node - # def initialize: (Integer flags, Array[Prism::node] elements, Location? opening_loc, Location? closing_loc, Location location) -> void + # Initialize a new ArrayNode node. # # @return [ArrayNode] a new instance of ArrayNode # - # source://prism//lib/prism/node.rb#727 + # source://prism//lib/prism/node.rb#867 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, elements: T::Array[Prism::Node], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, flags, elements, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, elements, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#869 + # source://prism//lib/prism/node.rb#993 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#738 + # source://prism//lib/prism/node.rb#878 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#743 + # source://prism//lib/prism/node.rb#883 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#824 + # source://prism//lib/prism/node.rb#972 sig { returns(T.nilable(String)) } def closing; end @@ -936,19 +1037,19 @@ class Prism::ArrayNode < ::Prism::Node # %I(apple orange banana) # ")" # foo = 1, 2, 3 # nil # - # source://prism//lib/prism/node.rb#801 + # source://prism//lib/prism/node.rb#948 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#753 + # source://prism//lib/prism/node.rb#893 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#748 + # source://prism//lib/prism/node.rb#888 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end @@ -956,55 +1057,56 @@ class Prism::ArrayNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#814 + # source://prism//lib/prism/node.rb#911 sig { returns(T::Boolean) } def contains_splat?; end - # def copy: (?flags: Integer, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?, ?location: Location) -> ArrayNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode # - # source://prism//lib/prism/node.rb#758 + # source://prism//lib/prism/node.rb#898 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, elements: T::Array[Prism::Node], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).returns(Prism::ArrayNode) end - def copy(flags: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#743 + # source://prism//lib/prism/node.rb#883 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, elements: Array[Prism::node], opening_loc: Location?, closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, elements: Array[Prism::node], opening_loc: Location?, closing_loc: Location? } # - # source://prism//lib/prism/node.rb#766 + # source://prism//lib/prism/node.rb#906 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Represent the list of zero or more [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array. # - # source://prism//lib/prism/node.rb#775 + # source://prism//lib/prism/node.rb#916 sig { returns(T::Array[Prism::Node]) } def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#829 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#977 + sig { override.returns(String) } + def inspect; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#819 + # source://prism//lib/prism/node.rb#967 sig { returns(T.nilable(String)) } def opening; end @@ -1015,58 +1117,44 @@ class Prism::ArrayNode < ::Prism::Node # %I(apple orange banana) # "%I(" # foo = 1, 2, 3 # nil # - # source://prism//lib/prism/node.rb#783 + # source://prism//lib/prism/node.rb#924 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#962 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#938 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#853 + # source://prism//lib/prism/node.rb#982 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#771 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#863 + # source://prism//lib/prism/node.rb#987 def type; end end end # Flags for array nodes. # -# source://prism//lib/prism/node.rb#20343 +# source://prism//lib/prism/node.rb#18477 module Prism::ArrayNodeFlags; end # if array contains splat nodes # -# source://prism//lib/prism/node.rb#20345 +# source://prism//lib/prism/node.rb#18479 Prism::ArrayNodeFlags::CONTAINS_SPLAT = T.let(T.unsafe(nil), Integer) # Represents an array pattern in pattern matching. @@ -1077,8 +1165,8 @@ Prism::ArrayNodeFlags::CONTAINS_SPLAT = T.let(T.unsafe(nil), Integer) # foo in [1, 2] # ^^^^^^^^^^^^^ # -# foo in *1 -# ^^^^^^^^^ +# foo in *bar +# ^^^^^^^^^^^ # # foo in Bar[] # ^^^^^^^^^^^^ @@ -1086,171 +1174,184 @@ Prism::ArrayNodeFlags::CONTAINS_SPLAT = T.let(T.unsafe(nil), Integer) # foo in Bar[1, 2, 3] # ^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#895 +# source://prism//lib/prism/node.rb#1019 class Prism::ArrayPatternNode < ::Prism::Node - # def initialize: (Prism::node? constant, Array[Prism::node] requireds, Prism::node? rest, Array[Prism::node] posts, Location? opening_loc, Location? closing_loc, Location location) -> void + # Initialize a new ArrayPatternNode node. # # @return [ArrayPatternNode] a new instance of ArrayPatternNode # - # source://prism//lib/prism/node.rb#897 + # source://prism//lib/prism/node.rb#1021 sig do params( source: Prism::Source, - constant: T.nilable(Prism::Node), + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), requireds: T::Array[Prism::Node], rest: T.nilable(Prism::Node), posts: T::Array[Prism::Node], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, constant, requireds, rest, posts, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1047 + # source://prism//lib/prism/node.rb#1164 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#910 + # source://prism//lib/prism/node.rb#1035 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#915 + # source://prism//lib/prism/node.rb#1040 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#991 + # source://prism//lib/prism/node.rb#1143 sig { returns(T.nilable(String)) } def closing; end - # attr_reader closing_loc: Location? + # Represents the closing location of the array pattern. + # + # foo in [1, 2] + # ^ # - # source://prism//lib/prism/node.rb#973 + # source://prism//lib/prism/node.rb#1119 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#930 + # source://prism//lib/prism/node.rb#1055 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#920 + # source://prism//lib/prism/node.rb#1045 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader constant: Prism::node? + # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # - # source://prism//lib/prism/node.rb#948 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#1073 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end - # def copy: (?constant: Prism::node?, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?, ?location: Location) -> ArrayPatternNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode # - # source://prism//lib/prism/node.rb#935 + # source://prism//lib/prism/node.rb#1060 sig do params( - constant: T.nilable(Prism::Node), + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), requireds: T::Array[Prism::Node], rest: T.nilable(Prism::Node), posts: T::Array[Prism::Node], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).returns(Prism::ArrayPatternNode) end - def copy(constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#915 + # source://prism//lib/prism/node.rb#1040 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { constant: Prism::node?, requireds: Array[Prism::node], rest: Prism::node?, posts: Array[Prism::node], opening_loc: Location?, closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, requireds: Array[Prism::node], rest: Prism::node?, posts: Array[Prism::node], opening_loc: Location?, closing_loc: Location? } # - # source://prism//lib/prism/node.rb#943 + # source://prism//lib/prism/node.rb#1068 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#996 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1148 + sig { override.returns(String) } + def inspect; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#986 + # source://prism//lib/prism/node.rb#1138 sig { returns(T.nilable(String)) } def opening; end - # attr_reader opening_loc: Location? + # Represents the opening location of the array pattern. + # + # foo in [1, 2] + # ^ # - # source://prism//lib/prism/node.rb#960 + # source://prism//lib/prism/node.rb#1097 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end - # attr_reader posts: Array[Prism::node] + # Represents the elements after the rest element of the array pattern. # - # source://prism//lib/prism/node.rb#957 + # foo in *bar, baz + # ^^^ + # + # source://prism//lib/prism/node.rb#1091 sig { returns(T::Array[Prism::Node]) } def posts; end - # attr_reader requireds: Array[Prism::node] + # Represents the required elements of the array pattern. + # + # foo in [1, 2] + # ^ ^ # - # source://prism//lib/prism/node.rb#951 + # source://prism//lib/prism/node.rb#1079 sig { returns(T::Array[Prism::Node]) } def requireds; end - # attr_reader rest: Prism::node? + # Represents the rest element of the array pattern. + # + # foo in *bar + # ^^^^ # - # source://prism//lib/prism/node.rb#954 + # source://prism//lib/prism/node.rb#1085 sig { returns(T.nilable(Prism::Node)) } def rest; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#1133 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1111 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1031 + # source://prism//lib/prism/node.rb#1153 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#1041 + # source://prism//lib/prism/node.rb#1158 def type; end end end @@ -1260,88 +1361,92 @@ end # { a => b } # ^^^^^^ # -# source://prism//lib/prism/node.rb#1064 +# source://prism//lib/prism/node.rb#1181 class Prism::AssocNode < ::Prism::Node - # def initialize: (Prism::node key, Prism::node value, Location? operator_loc, Location location) -> void + # Initialize a new AssocNode node. # # @return [AssocNode] a new instance of AssocNode # - # source://prism//lib/prism/node.rb#1066 + # source://prism//lib/prism/node.rb#1183 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, key: Prism::Node, value: Prism::Node, - operator_loc: T.nilable(Prism::Location), - location: Prism::Location + operator_loc: T.nilable(Prism::Location) ).void end - def initialize(source, key, value, operator_loc, location); end + def initialize(source, node_id, location, flags, key, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1191 + # source://prism//lib/prism/node.rb#1291 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1076 + # source://prism//lib/prism/node.rb#1194 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1081 + # source://prism//lib/prism/node.rb#1199 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1091 + # source://prism//lib/prism/node.rb#1209 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1086 + # source://prism//lib/prism/node.rb#1204 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?, ?location: Location) -> AssocNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode # - # source://prism//lib/prism/node.rb#1096 + # source://prism//lib/prism/node.rb#1214 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, key: Prism::Node, value: Prism::Node, - operator_loc: T.nilable(Prism::Location), - location: Prism::Location + operator_loc: T.nilable(Prism::Location) ).returns(Prism::AssocNode) end - def copy(key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1081 + # source://prism//lib/prism/node.rb#1199 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { key: Prism::node, value: Prism::node, operator_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, key: Prism::node, value: Prism::node, operator_loc: Location? } # - # source://prism//lib/prism/node.rb#1104 + # source://prism//lib/prism/node.rb#1222 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1151 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1275 + sig { override.returns(String) } + def inspect; end # The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # @@ -1354,13 +1459,13 @@ class Prism::AssocNode < ::Prism::Node # { def a; end => 1 } # ^^^^^^^^^^ # - # source://prism//lib/prism/node.rb#1118 + # source://prism//lib/prism/node.rb#1236 sig { returns(Prism::Node) } def key; end # def operator: () -> String? # - # source://prism//lib/prism/node.rb#1146 + # source://prism//lib/prism/node.rb#1270 sig { returns(T.nilable(String)) } def operator; end @@ -1369,26 +1474,19 @@ class Prism::AssocNode < ::Prism::Node # { foo => bar } # ^^ # - # source://prism//lib/prism/node.rb#1133 + # source://prism//lib/prism/node.rb#1251 sig { returns(T.nilable(Prism::Location)) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1265 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1175 + # source://prism//lib/prism/node.rb#1280 sig { override.returns(Symbol) } def type; end @@ -1400,19 +1498,14 @@ class Prism::AssocNode < ::Prism::Node # { x: 1 } # ^ # - # source://prism//lib/prism/node.rb#1127 + # source://prism//lib/prism/node.rb#1245 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#1185 + # source://prism//lib/prism/node.rb#1285 def type; end end end @@ -1422,90 +1515,94 @@ end # { **foo } # ^^^^^ # -# source://prism//lib/prism/node.rb#1203 +# source://prism//lib/prism/node.rb#1303 class Prism::AssocSplatNode < ::Prism::Node - # def initialize: (Prism::node? value, Location operator_loc, Location location) -> void + # Initialize a new AssocSplatNode node. # # @return [AssocSplatNode] a new instance of AssocSplatNode # - # source://prism//lib/prism/node.rb#1205 + # source://prism//lib/prism/node.rb#1305 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, value: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, value, operator_loc, location); end + def initialize(source, node_id, location, flags, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1312 + # source://prism//lib/prism/node.rb#1393 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1214 + # source://prism//lib/prism/node.rb#1315 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1219 + # source://prism//lib/prism/node.rb#1320 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1231 + # source://prism//lib/prism/node.rb#1332 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1224 + # source://prism//lib/prism/node.rb#1325 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Prism::node?, ?operator_loc: Location, ?location: Location) -> AssocSplatNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode # - # source://prism//lib/prism/node.rb#1236 + # source://prism//lib/prism/node.rb#1337 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, value: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::AssocSplatNode) end - def copy(value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1219 + # source://prism//lib/prism/node.rb#1320 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Prism::node?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#1244 + # source://prism//lib/prism/node.rb#1345 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1270 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1377 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#1265 + # source://prism//lib/prism/node.rb#1372 sig { returns(String) } def operator; end @@ -1514,26 +1611,19 @@ class Prism::AssocSplatNode < ::Prism::Node # { **x } # ^^ # - # source://prism//lib/prism/node.rb#1258 + # source://prism//lib/prism/node.rb#1359 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1367 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1296 + # source://prism//lib/prism/node.rb#1382 sig { override.returns(Symbol) } def type; end @@ -1542,26 +1632,21 @@ class Prism::AssocSplatNode < ::Prism::Node # { **foo } # ^^^ # - # source://prism//lib/prism/node.rb#1252 + # source://prism//lib/prism/node.rb#1353 sig { returns(T.nilable(Prism::Node)) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#1306 + # source://prism//lib/prism/node.rb#1387 def type; end end end # The FFI backend is used on other Ruby implementations. # -# source://prism//lib/prism.rb#84 +# source://prism//lib/prism.rb#81 Prism::BACKEND = T.let(T.unsafe(nil), Symbol) # Represents reading a reference to a field in the previous match. @@ -1569,73 +1654,80 @@ Prism::BACKEND = T.let(T.unsafe(nil), Symbol) # $' # ^^ # -# source://prism//lib/prism/node.rb#1323 +# source://prism//lib/prism/node.rb#1404 class Prism::BackReferenceReadNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new BackReferenceReadNode node. # # @return [BackReferenceReadNode] a new instance of BackReferenceReadNode # - # source://prism//lib/prism/node.rb#1325 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#1406 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1409 + # source://prism//lib/prism/node.rb#1471 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1333 + # source://prism//lib/prism/node.rb#1415 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1338 + # source://prism//lib/prism/node.rb#1420 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1348 + # source://prism//lib/prism/node.rb#1430 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1343 + # source://prism//lib/prism/node.rb#1425 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> BackReferenceReadNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BackReferenceReadNode # - # source://prism//lib/prism/node.rb#1353 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::BackReferenceReadNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1435 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::BackReferenceReadNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1338 + # source://prism//lib/prism/node.rb#1420 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#1361 + # source://prism//lib/prism/node.rb#1443 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1373 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1455 + sig { override.returns(String) } + def inspect; end # The name of the back-reference variable, including the leading `$`. # @@ -1643,38 +1735,20 @@ class Prism::BackReferenceReadNode < ::Prism::Node # # $+ # name `:$+` # - # source://prism//lib/prism/node.rb#1370 + # source://prism//lib/prism/node.rb#1452 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1393 + # source://prism//lib/prism/node.rb#1460 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#1403 + # source://prism//lib/prism/node.rb#1465 def type; end end end @@ -1713,310 +1787,324 @@ end # end # ^^^^^ # -# source://prism//lib/prism/node.rb#1421 +# source://prism//lib/prism/node.rb#1483 class Prism::BeginNode < ::Prism::Node - # def initialize: (Location? begin_keyword_loc, StatementsNode? statements, RescueNode? rescue_clause, ElseNode? else_clause, EnsureNode? ensure_clause, Location? end_keyword_loc, Location location) -> void + # Initialize a new BeginNode node. # # @return [BeginNode] a new instance of BeginNode # - # source://prism//lib/prism/node.rb#1423 + # source://prism//lib/prism/node.rb#1485 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, begin_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), rescue_clause: T.nilable(Prism::RescueNode), else_clause: T.nilable(Prism::ElseNode), ensure_clause: T.nilable(Prism::EnsureNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).void end - def initialize(source, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1587 + # source://prism//lib/prism/node.rb#1631 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1436 + # source://prism//lib/prism/node.rb#1499 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def begin_keyword: () -> String? # - # source://prism//lib/prism/node.rb#1516 + # source://prism//lib/prism/node.rb#1605 sig { returns(T.nilable(String)) } def begin_keyword; end - # attr_reader begin_keyword_loc: Location? + # Represents the location of the `begin` keyword. + # + # begin x end + # ^^^^^ # - # source://prism//lib/prism/node.rb#1478 + # source://prism//lib/prism/node.rb#1540 sig { returns(T.nilable(Prism::Location)) } def begin_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1445 + # source://prism//lib/prism/node.rb#1504 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1460 + # source://prism//lib/prism/node.rb#1519 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1450 + # source://prism//lib/prism/node.rb#1509 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?, ?location: Location) -> BeginNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode # - # source://prism//lib/prism/node.rb#1465 + # source://prism//lib/prism/node.rb#1524 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, begin_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), rescue_clause: T.nilable(Prism::RescueNode), else_clause: T.nilable(Prism::ElseNode), ensure_clause: T.nilable(Prism::EnsureNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).returns(Prism::BeginNode) end - def copy(begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1445 + # source://prism//lib/prism/node.rb#1504 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { begin_keyword_loc: Location?, statements: StatementsNode?, rescue_clause: RescueNode?, else_clause: ElseNode?, ensure_clause: EnsureNode?, end_keyword_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, begin_keyword_loc: Location?, statements: StatementsNode?, rescue_clause: RescueNode?, else_clause: ElseNode?, ensure_clause: EnsureNode?, end_keyword_loc: Location? } # - # source://prism//lib/prism/node.rb#1473 + # source://prism//lib/prism/node.rb#1532 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader else_clause: ElseNode? + # Represents the else clause within the begin block. # - # source://prism//lib/prism/node.rb#1497 + # begin x; rescue y; else z; end + # ^^^^^^ + # + # source://prism//lib/prism/node.rb#1574 sig { returns(T.nilable(Prism::ElseNode)) } def else_clause; end # def end_keyword: () -> String? # - # source://prism//lib/prism/node.rb#1521 + # source://prism//lib/prism/node.rb#1610 sig { returns(T.nilable(String)) } def end_keyword; end - # attr_reader end_keyword_loc: Location? + # Represents the location of the `end` keyword. # - # source://prism//lib/prism/node.rb#1503 + # begin x end + # ^^^ + # + # source://prism//lib/prism/node.rb#1586 sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end - # attr_reader ensure_clause: EnsureNode? + # Represents the ensure clause within the begin block. # - # source://prism//lib/prism/node.rb#1500 + # begin x; ensure y; end + # ^^^^^^^^ + # + # source://prism//lib/prism/node.rb#1580 sig { returns(T.nilable(Prism::EnsureNode)) } def ensure_clause; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1526 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1615 + sig { override.returns(String) } + def inspect; end - # attr_reader rescue_clause: RescueNode? + # source://prism//lib/prism/parse_result/newlines.rb#79 + def newline_flag!(lines); end + + # Represents the rescue clause within the begin block. + # + # begin x; rescue y; end + # ^^^^^^^^ # - # source://prism//lib/prism/node.rb#1494 + # source://prism//lib/prism/node.rb#1568 sig { returns(T.nilable(Prism::RescueNode)) } def rescue_clause; end - # source://prism//lib/prism/node.rb#1440 - def set_newline_flag(newline_marked); end + # Save the begin_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#1554 + def save_begin_keyword_loc(repository); end - # attr_reader statements: StatementsNode? + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#1491 - sig { returns(T.nilable(Prism::StatementsNode)) } - def statements; end + # source://prism//lib/prism/node.rb#1600 + def save_end_keyword_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Represents the statements within the begin block. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # begin x end + # ^ # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1562 + sig { returns(T.nilable(Prism::StatementsNode)) } + def statements; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1571 + # source://prism//lib/prism/node.rb#1620 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#1581 + # source://prism//lib/prism/node.rb#1625 def type; end end end -# Represents block method arguments. +# Represents a block argument using `&`. # # bar(&args) # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#1602 +# source://prism//lib/prism/node.rb#1646 class Prism::BlockArgumentNode < ::Prism::Node - # def initialize: (Prism::node? expression, Location operator_loc, Location location) -> void + # Initialize a new BlockArgumentNode node. # # @return [BlockArgumentNode] a new instance of BlockArgumentNode # - # source://prism//lib/prism/node.rb#1604 + # source://prism//lib/prism/node.rb#1648 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, expression: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, expression, operator_loc, location); end + def initialize(source, node_id, location, flags, expression, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1705 + # source://prism//lib/prism/node.rb#1736 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1613 + # source://prism//lib/prism/node.rb#1658 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1618 + # source://prism//lib/prism/node.rb#1663 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1630 + # source://prism//lib/prism/node.rb#1675 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1623 + # source://prism//lib/prism/node.rb#1668 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?expression: Prism::node?, ?operator_loc: Location, ?location: Location) -> BlockArgumentNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode # - # source://prism//lib/prism/node.rb#1635 + # source://prism//lib/prism/node.rb#1680 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, expression: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::BlockArgumentNode) end - def copy(expression: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1618 + # source://prism//lib/prism/node.rb#1663 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { expression: Prism::node?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#1643 + # source://prism//lib/prism/node.rb#1688 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader expression: Prism::node? + # The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#1648 + # foo(&args) + # ^^^^^ + # + # source://prism//lib/prism/node.rb#1696 sig { returns(T.nilable(Prism::Node)) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1663 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1720 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#1658 + # source://prism//lib/prism/node.rb#1715 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the `&` operator. + # + # foo(&args) + # ^ # - # source://prism//lib/prism/node.rb#1651 + # source://prism//lib/prism/node.rb#1702 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1710 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1689 + # source://prism//lib/prism/node.rb#1725 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#1699 + # source://prism//lib/prism/node.rb#1730 def type; end end end @@ -2026,77 +2114,87 @@ end # a { |; b| } # ^ # -# source://prism//lib/prism/node.rb#1716 +# source://prism//lib/prism/node.rb#1747 class Prism::BlockLocalVariableNode < ::Prism::Node - # def initialize: (Integer flags, Symbol name, Location location) -> void + # Initialize a new BlockLocalVariableNode node. # # @return [BlockLocalVariableNode] a new instance of BlockLocalVariableNode # - # source://prism//lib/prism/node.rb#1718 - sig { params(source: Prism::Source, flags: Integer, name: Symbol, location: Prism::Location).void } - def initialize(source, flags, name, location); end + # source://prism//lib/prism/node.rb#1749 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1810 + # source://prism//lib/prism/node.rb#1818 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1727 + # source://prism//lib/prism/node.rb#1758 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1732 + # source://prism//lib/prism/node.rb#1763 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1742 + # source://prism//lib/prism/node.rb#1773 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1737 + # source://prism//lib/prism/node.rb#1768 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol, ?location: Location) -> BlockLocalVariableNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode # - # source://prism//lib/prism/node.rb#1747 - sig { params(flags: Integer, name: Symbol, location: Prism::Location).returns(Prism::BlockLocalVariableNode) } - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1778 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::BlockLocalVariableNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1732 + # source://prism//lib/prism/node.rb#1763 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#1755 + # source://prism//lib/prism/node.rb#1786 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1772 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1802 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # The name of the block local variable. # - # source://prism//lib/prism/node.rb#1764 + # a { |; b| } # name `:b` + # ^ + # + # source://prism//lib/prism/node.rb#1799 sig { returns(Symbol) } def name; end @@ -2104,46 +2202,20 @@ class Prism::BlockLocalVariableNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#1767 + # source://prism//lib/prism/node.rb#1791 sig { returns(T::Boolean) } def repeated_parameter?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1794 + # source://prism//lib/prism/node.rb#1807 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#1760 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#1804 + # source://prism//lib/prism/node.rb#1812 def type; end end end @@ -2153,279 +2225,309 @@ end # [1, 2, 3].each { |i| puts x } # ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#1821 +# source://prism//lib/prism/node.rb#1829 class Prism::BlockNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, Prism::node? parameters, Prism::node? body, Location opening_loc, Location closing_loc, Location location) -> void + # Initialize a new BlockNode node. # # @return [BlockNode] a new instance of BlockNode # - # source://prism//lib/prism/node.rb#1823 + # source://prism//lib/prism/node.rb#1831 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, locals: T::Array[Symbol], - parameters: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).void end - def initialize(source, locals, parameters, body, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#1954 + # source://prism//lib/prism/node.rb#1960 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1835 + # source://prism//lib/prism/node.rb#1844 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? + # The body of the block. # - # source://prism//lib/prism/node.rb#1877 - sig { returns(T.nilable(Prism::Node)) } + # [1, 2, 3].each { |i| puts x } + # ^^^^^^ + # + # source://prism//lib/prism/node.rb#1899 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1840 + # source://prism//lib/prism/node.rb#1849 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#1899 + # source://prism//lib/prism/node.rb#1939 sig { returns(String) } def closing; end - # attr_reader closing_loc: Location + # Represents the location of the closing `|`. # - # source://prism//lib/prism/node.rb#1887 + # [1, 2, 3].each { |i| puts x } + # ^ + # + # source://prism//lib/prism/node.rb#1921 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1853 + # source://prism//lib/prism/node.rb#1862 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1845 + # source://prism//lib/prism/node.rb#1854 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?locals: Array[Symbol], ?parameters: Prism::node?, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location, ?location: Location) -> BlockNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, ?body: StatementsNode | BeginNode | nil, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode # - # source://prism//lib/prism/node.rb#1858 + # source://prism//lib/prism/node.rb#1867 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, locals: T::Array[Symbol], - parameters: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).returns(Prism::BlockNode) end - def copy(locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1840 + # source://prism//lib/prism/node.rb#1849 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], parameters: Prism::node?, body: Prism::node?, opening_loc: Location, closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, body: StatementsNode | BeginNode | nil, opening_loc: Location, closing_loc: Location } # - # source://prism//lib/prism/node.rb#1866 + # source://prism//lib/prism/node.rb#1875 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#1904 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#1944 + sig { override.returns(String) } + def inspect; end - # attr_reader locals: Array[Symbol] + # The local variables declared in the block. # - # source://prism//lib/prism/node.rb#1871 + # [1, 2, 3].each { |i| puts x } # locals: [:i] + # ^ + # + # source://prism//lib/prism/node.rb#1883 sig { returns(T::Array[Symbol]) } def locals; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#1894 + # source://prism//lib/prism/node.rb#1934 sig { returns(String) } def opening; end - # attr_reader opening_loc: Location + # Represents the location of the opening `|`. # - # source://prism//lib/prism/node.rb#1880 + # [1, 2, 3].each { |i| puts x } + # ^ + # + # source://prism//lib/prism/node.rb#1905 sig { returns(Prism::Location) } def opening_loc; end - # attr_reader parameters: Prism::node? + # The parameters of the block. # - # source://prism//lib/prism/node.rb#1874 - sig { returns(T.nilable(Prism::Node)) } + # [1, 2, 3].each { |i| puts x } + # ^^^ + # [1, 2, 3].each { puts _1 } + # ^^^^^^^^^^^ + # [1, 2, 3].each { puts it } + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#1893 + sig { returns(T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode))) } def parameters; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#1929 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#1913 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#1938 + # source://prism//lib/prism/node.rb#1949 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#1948 + # source://prism//lib/prism/node.rb#1954 def type; end end end -# Represents a block parameter to a method, block, or lambda definition. +# Represents a block parameter of a method, block, or lambda definition. # # def a(&b) # ^^ # end # -# source://prism//lib/prism/node.rb#1970 +# source://prism//lib/prism/node.rb#1976 class Prism::BlockParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol? name, Location? name_loc, Location operator_loc, Location location) -> void + # Initialize a new BlockParameterNode node. # # @return [BlockParameterNode] a new instance of BlockParameterNode # - # source://prism//lib/prism/node.rb#1972 + # source://prism//lib/prism/node.rb#1978 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, name: T.nilable(Symbol), name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, flags, name, name_loc, operator_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#2097 + # source://prism//lib/prism/node.rb#2094 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#1983 + # source://prism//lib/prism/node.rb#1989 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1988 + # source://prism//lib/prism/node.rb#1994 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#1998 + # source://prism//lib/prism/node.rb#2004 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#1993 + # source://prism//lib/prism/node.rb#1999 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location, ?location: Location) -> BlockParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode # - # source://prism//lib/prism/node.rb#2003 + # source://prism//lib/prism/node.rb#2009 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, name: T.nilable(Symbol), name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::BlockParameterNode) end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#1988 + # source://prism//lib/prism/node.rb#1994 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol?, name_loc: Location?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol?, name_loc: Location?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#2011 + # source://prism//lib/prism/node.rb#2017 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2053 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#2078 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol? + # The name of the block parameter. # - # source://prism//lib/prism/node.rb#2020 + # def a(&b) # name `:b` + # ^ + # end + # + # source://prism//lib/prism/node.rb#2031 sig { returns(T.nilable(Symbol)) } def name; end - # attr_reader name_loc: Location? + # Represents the location of the block parameter name. + # + # def a(&b) + # ^ # - # source://prism//lib/prism/node.rb#2023 + # source://prism//lib/prism/node.rb#2037 sig { returns(T.nilable(Prism::Location)) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#2048 + # source://prism//lib/prism/node.rb#2073 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the `&` operator. + # + # def a(&b) + # ^ + # end # - # source://prism//lib/prism/node.rb#2036 + # source://prism//lib/prism/node.rb#2060 sig { returns(Prism::Location) } def operator_loc; end @@ -2433,46 +2535,32 @@ class Prism::BlockParameterNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2043 + # source://prism//lib/prism/node.rb#2022 sig { returns(T::Boolean) } def repeated_parameter?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#2051 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2068 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#2081 + # source://prism//lib/prism/node.rb#2083 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#2016 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#2091 + # source://prism//lib/prism/node.rb#2088 def type; end end end @@ -2486,155 +2574,181 @@ end # ^^^^^^^^^^^^^^^^^ # end # -# source://prism//lib/prism/node.rb#2114 +# source://prism//lib/prism/node.rb#2111 class Prism::BlockParametersNode < ::Prism::Node - # def initialize: (ParametersNode? parameters, Array[BlockLocalVariableNode] locals, Location? opening_loc, Location? closing_loc, Location location) -> void + # Initialize a new BlockParametersNode node. # # @return [BlockParametersNode] a new instance of BlockParametersNode # - # source://prism//lib/prism/node.rb#2116 + # source://prism//lib/prism/node.rb#2113 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, parameters: T.nilable(Prism::ParametersNode), locals: T::Array[Prism::BlockLocalVariableNode], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, parameters, locals, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#2249 + # source://prism//lib/prism/node.rb#2259 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#2127 + # source://prism//lib/prism/node.rb#2125 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2132 + # source://prism//lib/prism/node.rb#2130 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#2200 + # source://prism//lib/prism/node.rb#2238 sig { returns(T.nilable(String)) } def closing; end - # attr_reader closing_loc: Location? + # Represents the closing location of the block parameters. + # + # -> (a, b = 1; local) { } + # ^ # - # source://prism//lib/prism/node.rb#2182 + # foo do |a, b = 1; local| + # ^ + # end + # + # source://prism//lib/prism/node.rb#2214 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#2145 + # source://prism//lib/prism/node.rb#2143 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#2137 + # source://prism//lib/prism/node.rb#2135 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?, ?location: Location) -> BlockParametersNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode # - # source://prism//lib/prism/node.rb#2150 + # source://prism//lib/prism/node.rb#2148 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, parameters: T.nilable(Prism::ParametersNode), locals: T::Array[Prism::BlockLocalVariableNode], opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).returns(Prism::BlockParametersNode) end - def copy(parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2132 + # source://prism//lib/prism/node.rb#2130 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { parameters: ParametersNode?, locals: Array[BlockLocalVariableNode], opening_loc: Location?, closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parameters: ParametersNode?, locals: Array[BlockLocalVariableNode], opening_loc: Location?, closing_loc: Location? } # - # source://prism//lib/prism/node.rb#2158 + # source://prism//lib/prism/node.rb#2156 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2205 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#2243 + sig { override.returns(String) } + def inspect; end - # attr_reader locals: Array[BlockLocalVariableNode] + # Represents the local variables of the block. + # + # -> (a, b = 1; local) { } + # ^^^^^ + # + # foo do |a, b = 1; local| + # ^^^^^ + # end # - # source://prism//lib/prism/node.rb#2166 + # source://prism//lib/prism/node.rb#2178 sig { returns(T::Array[Prism::BlockLocalVariableNode]) } def locals; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#2195 + # source://prism//lib/prism/node.rb#2233 sig { returns(T.nilable(String)) } def opening; end - # attr_reader opening_loc: Location? + # Represents the opening location of the block parameters. + # + # -> (a, b = 1; local) { } + # ^ # - # source://prism//lib/prism/node.rb#2169 + # foo do |a, b = 1; local| + # ^ + # end + # + # source://prism//lib/prism/node.rb#2188 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end - # attr_reader parameters: ParametersNode? + # Represents the parameters of the block. + # + # -> (a, b = 1; local) { } + # ^^^^^^^^ + # + # foo do |a, b = 1; local| + # ^^^^^^^^ + # end # - # source://prism//lib/prism/node.rb#2163 + # source://prism//lib/prism/node.rb#2168 sig { returns(T.nilable(Prism::ParametersNode)) } def parameters; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#2228 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2202 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#2233 + # source://prism//lib/prism/node.rb#2248 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#2243 + # source://prism//lib/prism/node.rb#2253 def type; end end end @@ -2644,32 +2758,34 @@ end # break foo # ^^^^^^^^^ # -# source://prism//lib/prism/node.rb#2263 +# source://prism//lib/prism/node.rb#2273 class Prism::BreakNode < ::Prism::Node - # def initialize: (ArgumentsNode? arguments, Location keyword_loc, Location location) -> void + # Initialize a new BreakNode node. # # @return [BreakNode] a new instance of BreakNode # - # source://prism//lib/prism/node.rb#2265 + # source://prism//lib/prism/node.rb#2275 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, arguments: T.nilable(Prism::ArgumentsNode), - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).void end - def initialize(source, arguments, keyword_loc, location); end + def initialize(source, node_id, location, flags, arguments, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#2372 + # source://prism//lib/prism/node.rb#2363 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#2274 + # source://prism//lib/prism/node.rb#2285 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -2678,65 +2794,67 @@ class Prism::BreakNode < ::Prism::Node # break foo # ^^^ # - # source://prism//lib/prism/node.rb#2312 + # source://prism//lib/prism/node.rb#2323 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2279 + # source://prism//lib/prism/node.rb#2290 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#2291 + # source://prism//lib/prism/node.rb#2302 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#2284 + # source://prism//lib/prism/node.rb#2295 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?arguments: ArgumentsNode?, ?keyword_loc: Location, ?location: Location) -> BreakNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode # - # source://prism//lib/prism/node.rb#2296 + # source://prism//lib/prism/node.rb#2307 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, arguments: T.nilable(Prism::ArgumentsNode), - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).returns(Prism::BreakNode) end - def copy(arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2279 + # source://prism//lib/prism/node.rb#2290 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { arguments: ArgumentsNode?, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, arguments: ArgumentsNode?, keyword_loc: Location } # - # source://prism//lib/prism/node.rb#2304 + # source://prism//lib/prism/node.rb#2315 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2330 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#2347 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#2325 + # source://prism//lib/prism/node.rb#2342 sig { returns(String) } def keyword; end @@ -2745,38 +2863,26 @@ class Prism::BreakNode < ::Prism::Node # break foo # ^^^^^ # - # source://prism//lib/prism/node.rb#2318 + # source://prism//lib/prism/node.rb#2329 sig { returns(Prism::Location) } def keyword_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2337 + def save_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#2356 + # source://prism//lib/prism/node.rb#2352 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#2366 + # source://prism//lib/prism/node.rb#2357 def type; end end end @@ -2786,16 +2892,18 @@ end # foo.bar &&= value # ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#2383 +# source://prism//lib/prism/node.rb#2374 class Prism::CallAndWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new CallAndWriteNode node. # # @return [CallAndWriteNode] a new instance of CallAndWriteNode # - # source://prism//lib/prism/node.rb#2385 + # source://prism//lib/prism/node.rb#2376 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -2803,21 +2911,20 @@ class Prism::CallAndWriteNode < ::Prism::Node read_name: Symbol, write_name: Symbol, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#2570 + # source://prism//lib/prism/node.rb#2562 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#2400 + # source://prism//lib/prism/node.rb#2391 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -2825,45 +2932,50 @@ class Prism::CallAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2495 + # source://prism//lib/prism/node.rb#2437 sig { returns(T::Boolean) } def attribute_write?; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#2505 + # source://prism//lib/prism/node.rb#2531 sig { returns(T.nilable(String)) } def call_operator; end - # attr_reader call_operator_loc: Location? + # Represents the location of the call operator. + # + # foo.bar &&= value + # ^ # - # source://prism//lib/prism/node.rb#2443 + # source://prism//lib/prism/node.rb#2456 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2405 + # source://prism//lib/prism/node.rb#2396 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#2418 + # source://prism//lib/prism/node.rb#2409 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#2410 + # source://prism//lib/prism/node.rb#2401 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> CallAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode # - # source://prism//lib/prism/node.rb#2423 + # source://prism//lib/prism/node.rb#2414 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -2871,22 +2983,21 @@ class Prism::CallAndWriteNode < ::Prism::Node read_name: Symbol, write_name: Symbol, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::CallAndWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2405 + # source://prism//lib/prism/node.rb#2396 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#2431 + # source://prism//lib/prism/node.rb#2422 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -2897,49 +3008,61 @@ class Prism::CallAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2500 + # source://prism//lib/prism/node.rb#2442 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2520 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#2546 + sig { override.returns(String) } + def inspect; end # def message: () -> String? # - # source://prism//lib/prism/node.rb#2510 + # source://prism//lib/prism/node.rb#2536 sig { returns(T.nilable(String)) } def message; end - # attr_reader message_loc: Location? + # Represents the location of the message. # - # source://prism//lib/prism/node.rb#2456 + # foo.bar &&= value + # ^^^ + # + # source://prism//lib/prism/node.rb#2478 sig { returns(T.nilable(Prism::Location)) } def message_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#2515 + # source://prism//lib/prism/node.rb#2541 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the operator. + # + # foo.bar &&= value + # ^^^ # - # source://prism//lib/prism/node.rb#2475 + # source://prism//lib/prism/node.rb#2512 sig { returns(Prism::Location) } def operator_loc; end - # attr_reader read_name: Symbol + # Represents the name of the method being called. # - # source://prism//lib/prism/node.rb#2469 + # foo.bar &&= value # read_name `:bar` + # ^^^ + # + # source://prism//lib/prism/node.rb#2500 sig { returns(Symbol) } def read_name; end - # attr_reader receiver: Prism::node? + # The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # foo.bar &&= value + # ^^^ # - # source://prism//lib/prism/node.rb#2440 + # source://prism//lib/prism/node.rb#2450 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -2947,32 +3070,40 @@ class Prism::CallAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2485 + # source://prism//lib/prism/node.rb#2427 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#2470 + def save_call_operator_loc(repository); end + + # Save the message_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#2492 + def save_message_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2520 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#2554 + # source://prism//lib/prism/node.rb#2551 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # Represents the value being assigned. # - # source://prism//lib/prism/node.rb#2482 + # foo.bar &&= value + # ^^^^^ + # + # source://prism//lib/prism/node.rb#2528 sig { returns(Prism::Node) } def value; end @@ -2980,33 +3111,23 @@ class Prism::CallAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2490 + # source://prism//lib/prism/node.rb#2432 sig { returns(T::Boolean) } def variable_call?; end - # attr_reader write_name: Symbol + # Represents the name of the method being written to. + # + # foo.bar &&= value # write_name `:bar=` + # ^^^ # - # source://prism//lib/prism/node.rb#2472 + # source://prism//lib/prism/node.rb#2506 sig { returns(Symbol) } def write_name; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#2436 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#2564 + # source://prism//lib/prism/node.rb#2556 def type; end end end @@ -3031,16 +3152,18 @@ end # foo&.bar # ^^^^^^^^ # -# source://prism//lib/prism/node.rb#2602 +# source://prism//lib/prism/node.rb#2594 class Prism::CallNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Symbol name, Location? message_loc, Location? opening_loc, ArgumentsNode? arguments, Location? closing_loc, Prism::node? block, Location location) -> void + # Initialize a new CallNode node. # # @return [CallNode] a new instance of CallNode # - # source://prism//lib/prism/node.rb#2604 + # source://prism//lib/prism/node.rb#2596 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -3049,27 +3172,29 @@ class Prism::CallNode < ::Prism::Node opening_loc: T.nilable(Prism::Location), arguments: T.nilable(Prism::ArgumentsNode), closing_loc: T.nilable(Prism::Location), - block: T.nilable(Prism::Node), - location: Prism::Location + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) ).void end - def initialize(source, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#2834 + # source://prism//lib/prism/node.rb#2825 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#2620 + # source://prism//lib/prism/node.rb#2612 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader arguments: ArgumentsNode? + # Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#2715 + # foo(bar) + # ^^^ + # + # source://prism//lib/prism/node.rb#2758 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end @@ -3077,63 +3202,77 @@ class Prism::CallNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2744 + # source://prism//lib/prism/node.rb#2659 sig { returns(T::Boolean) } def attribute_write?; end - # attr_reader block: Prism::node? + # Represents the block that is being passed to the method. # - # source://prism//lib/prism/node.rb#2731 - sig { returns(T.nilable(Prism::Node)) } + # foo { |a| a } + # ^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#2786 + sig { returns(T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode))) } def block; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#2754 + # source://prism//lib/prism/node.rb#2789 sig { returns(T.nilable(String)) } def call_operator; end - # attr_reader call_operator_loc: Location? + # Represents the location of the call operator. + # + # foo.bar + # ^ + # + # foo&.bar + # ^^ # - # source://prism//lib/prism/node.rb#2673 + # source://prism//lib/prism/node.rb#2687 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2625 + # source://prism//lib/prism/node.rb#2617 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#2769 + # source://prism//lib/prism/node.rb#2804 sig { returns(T.nilable(String)) } def closing; end - # attr_reader closing_loc: Location? + # Represents the location of the right parenthesis. # - # source://prism//lib/prism/node.rb#2718 + # foo(bar) + # ^ + # + # source://prism//lib/prism/node.rb#2764 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#2639 + # source://prism//lib/prism/node.rb#2631 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#2630 + # source://prism//lib/prism/node.rb#2622 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?block: Prism::node?, ?location: Location) -> CallNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?block: BlockNode | BlockArgumentNode | nil) -> CallNode # - # source://prism//lib/prism/node.rb#2644 + # source://prism//lib/prism/node.rb#2636 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -3142,69 +3281,90 @@ class Prism::CallNode < ::Prism::Node opening_loc: T.nilable(Prism::Location), arguments: T.nilable(Prism::ArgumentsNode), closing_loc: T.nilable(Prism::Location), - block: T.nilable(Prism::Node), - location: Prism::Location + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) ).returns(Prism::CallNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2625 + # source://prism//lib/prism/node.rb#2617 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, name: Symbol, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: Prism::node?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, name: Symbol, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: BlockNode | BlockArgumentNode | nil } # - # source://prism//lib/prism/node.rb#2652 + # source://prism//lib/prism/node.rb#2644 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end + # When a call node has the attribute_write flag set, it means that the call + # is using the attribute write syntax. This is either a method call to []= + # or a method call to a method that ends with =. Either way, the = sign is + # present in the source. + # + # Prism returns the message_loc _without_ the = sign attached, because there + # can be any amount of space between the message and the = sign. However, + # sometimes you want the location of the full message including the inner + # space and the = sign. This method provides that. + # + # source://prism//lib/prism/node_ext.rb#331 + sig { returns(T.nilable(Prism::Location)) } + def full_message_loc; end + # def ignore_visibility?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2749 + # source://prism//lib/prism/node.rb#2664 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2774 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#2809 + sig { override.returns(String) } + def inspect; end # def message: () -> String? # - # source://prism//lib/prism/node.rb#2759 + # source://prism//lib/prism/node.rb#2794 sig { returns(T.nilable(String)) } def message; end - # attr_reader message_loc: Location? + # Represents the location of the message. + # + # foo.bar + # ^^^ # - # source://prism//lib/prism/node.rb#2689 + # source://prism//lib/prism/node.rb#2715 sig { returns(T.nilable(Prism::Location)) } def message_loc; end - # attr_reader name: Symbol + # Represents the name of the method being called. + # + # foo.bar # name `:foo` + # ^^^ # - # source://prism//lib/prism/node.rb#2686 + # source://prism//lib/prism/node.rb#2709 sig { returns(Symbol) } def name; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#2764 + # source://prism//lib/prism/node.rb#2799 sig { returns(T.nilable(String)) } def opening; end - # attr_reader opening_loc: Location? + # Represents the location of the left parenthesis. + # foo(bar) + # ^ # - # source://prism//lib/prism/node.rb#2702 + # source://prism//lib/prism/node.rb#2736 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end @@ -3219,7 +3379,7 @@ class Prism::CallNode < ::Prism::Node # foo + bar # ^^^ # - # source://prism//lib/prism/node.rb#2670 + # source://prism//lib/prism/node.rb#2678 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -3227,26 +3387,37 @@ class Prism::CallNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2734 + # source://prism//lib/prism/node.rb#2649 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#2701 + def save_call_operator_loc(repository); end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#2778 + def save_closing_loc(repository); end + + # Save the message_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#2729 + def save_message_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2750 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#2818 + # source://prism//lib/prism/node.rb#2814 sig { override.returns(Symbol) } def type; end @@ -3254,54 +3425,41 @@ class Prism::CallNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2739 + # source://prism//lib/prism/node.rb#2654 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#2657 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#2828 + # source://prism//lib/prism/node.rb#2819 def type; end end end # Flags for call nodes. # -# source://prism//lib/prism/node.rb#20349 +# source://prism//lib/prism/node.rb#18483 module Prism::CallNodeFlags; end # a call that is an attribute write, so the value being written should be returned # -# source://prism//lib/prism/node.rb#20357 +# source://prism//lib/prism/node.rb#18491 Prism::CallNodeFlags::ATTRIBUTE_WRITE = T.let(T.unsafe(nil), Integer) # a call that ignores method visibility # -# source://prism//lib/prism/node.rb#20360 +# source://prism//lib/prism/node.rb#18494 Prism::CallNodeFlags::IGNORE_VISIBILITY = T.let(T.unsafe(nil), Integer) # &. operator # -# source://prism//lib/prism/node.rb#20351 +# source://prism//lib/prism/node.rb#18485 Prism::CallNodeFlags::SAFE_NAVIGATION = T.let(T.unsafe(nil), Integer) # a call that could have been a local variable # -# source://prism//lib/prism/node.rb#20354 +# source://prism//lib/prism/node.rb#18488 Prism::CallNodeFlags::VARIABLE_CALL = T.let(T.unsafe(nil), Integer) # Represents the use of an assignment operator on a call. @@ -3309,39 +3467,40 @@ Prism::CallNodeFlags::VARIABLE_CALL = T.let(T.unsafe(nil), Integer) # foo.bar += baz # ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#2852 +# source://prism//lib/prism/node.rb#2843 class Prism::CallOperatorWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol operator, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new CallOperatorWriteNode node. # # @return [CallOperatorWriteNode] a new instance of CallOperatorWriteNode # - # source://prism//lib/prism/node.rb#2854 + # source://prism//lib/prism/node.rb#2845 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), message_loc: T.nilable(Prism::Location), read_name: Symbol, write_name: Symbol, - operator: Symbol, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3039 + # source://prism//lib/prism/node.rb#3033 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#2870 + # source://prism//lib/prism/node.rb#2861 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -3349,69 +3508,91 @@ class Prism::CallOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2968 + # source://prism//lib/prism/node.rb#2907 sig { returns(T::Boolean) } def attribute_write?; end + # Represents the binary operator being used. + # + # foo.bar += value # binary_operator `:+` + # ^ + # + # source://prism//lib/prism/node.rb#2982 + sig { returns(Symbol) } + def binary_operator; end + + # Represents the location of the binary operator. + # + # foo.bar += value + # ^^ + # + # source://prism//lib/prism/node.rb#2988 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#2978 + # source://prism//lib/prism/node.rb#3007 sig { returns(T.nilable(String)) } def call_operator; end - # attr_reader call_operator_loc: Location? + # Represents the location of the call operator. + # + # foo.bar += value + # ^ # - # source://prism//lib/prism/node.rb#2913 + # source://prism//lib/prism/node.rb#2926 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2875 + # source://prism//lib/prism/node.rb#2866 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#2888 + # source://prism//lib/prism/node.rb#2879 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#2880 + # source://prism//lib/prism/node.rb#2871 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator: Symbol, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> CallOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode # - # source://prism//lib/prism/node.rb#2893 + # source://prism//lib/prism/node.rb#2884 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), message_loc: T.nilable(Prism::Location), read_name: Symbol, write_name: Symbol, - operator: Symbol, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node ).returns(Prism::CallOperatorWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#2875 + # source://prism//lib/prism/node.rb#2866 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, operator: Symbol, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#2901 + # source://prism//lib/prism/node.rb#2892 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -3422,49 +3603,58 @@ class Prism::CallOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2973 + # source://prism//lib/prism/node.rb#2912 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#2988 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3017 + sig { override.returns(String) } + def inspect; end # def message: () -> String? # - # source://prism//lib/prism/node.rb#2983 + # source://prism//lib/prism/node.rb#3012 sig { returns(T.nilable(String)) } def message; end - # attr_reader message_loc: Location? + # Represents the location of the message. # - # source://prism//lib/prism/node.rb#2926 - sig { returns(T.nilable(Prism::Location)) } + # foo.bar += value + # ^^^ + # + # source://prism//lib/prism/node.rb#2948 + sig { returns(T.nilable(Prism::Location)) } def message_loc; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#2945 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#339 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#2948 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#346 def operator_loc; end - # attr_reader read_name: Symbol + # Represents the name of the method being called. # - # source://prism//lib/prism/node.rb#2939 + # foo.bar += value # read_name `:bar` + # ^^^ + # + # source://prism//lib/prism/node.rb#2970 sig { returns(Symbol) } def read_name; end - # attr_reader receiver: Prism::node? + # The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # foo.bar += value + # ^^^ # - # source://prism//lib/prism/node.rb#2910 + # source://prism//lib/prism/node.rb#2920 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -3472,32 +3662,40 @@ class Prism::CallOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2958 + # source://prism//lib/prism/node.rb#2897 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#2996 + def save_binary_operator_loc(repository); end + + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#2940 + def save_call_operator_loc(repository); end + + # Save the message_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#2962 + def save_message_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#3023 + # source://prism//lib/prism/node.rb#3022 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # Represents the value being assigned. + # + # foo.bar += value + # ^^^^^ # - # source://prism//lib/prism/node.rb#2955 + # source://prism//lib/prism/node.rb#3004 sig { returns(Prism::Node) } def value; end @@ -3505,33 +3703,23 @@ class Prism::CallOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#2963 + # source://prism//lib/prism/node.rb#2902 sig { returns(T::Boolean) } def variable_call?; end - # attr_reader write_name: Symbol + # Represents the name of the method being written to. + # + # foo.bar += value # write_name `:bar=` + # ^^^ # - # source://prism//lib/prism/node.rb#2942 + # source://prism//lib/prism/node.rb#2976 sig { returns(Symbol) } def write_name; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#2906 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#3033 + # source://prism//lib/prism/node.rb#3027 def type; end end end @@ -3541,16 +3729,18 @@ end # foo.bar ||= value # ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#3057 +# source://prism//lib/prism/node.rb#3051 class Prism::CallOrWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new CallOrWriteNode node. # # @return [CallOrWriteNode] a new instance of CallOrWriteNode # - # source://prism//lib/prism/node.rb#3059 + # source://prism//lib/prism/node.rb#3053 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -3558,21 +3748,20 @@ class Prism::CallOrWriteNode < ::Prism::Node read_name: Symbol, write_name: Symbol, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3244 + # source://prism//lib/prism/node.rb#3239 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3074 + # source://prism//lib/prism/node.rb#3068 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -3580,45 +3769,50 @@ class Prism::CallOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3169 + # source://prism//lib/prism/node.rb#3114 sig { returns(T::Boolean) } def attribute_write?; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#3179 + # source://prism//lib/prism/node.rb#3208 sig { returns(T.nilable(String)) } def call_operator; end - # attr_reader call_operator_loc: Location? + # Represents the location of the call operator. + # + # foo.bar ||= value + # ^ # - # source://prism//lib/prism/node.rb#3117 + # source://prism//lib/prism/node.rb#3133 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3079 + # source://prism//lib/prism/node.rb#3073 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3092 + # source://prism//lib/prism/node.rb#3086 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3084 + # source://prism//lib/prism/node.rb#3078 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> CallOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode # - # source://prism//lib/prism/node.rb#3097 + # source://prism//lib/prism/node.rb#3091 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), @@ -3626,22 +3820,21 @@ class Prism::CallOrWriteNode < ::Prism::Node read_name: Symbol, write_name: Symbol, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::CallOrWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3079 + # source://prism//lib/prism/node.rb#3073 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#3105 + # source://prism//lib/prism/node.rb#3099 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -3652,49 +3845,61 @@ class Prism::CallOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3174 + # source://prism//lib/prism/node.rb#3119 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3194 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3223 + sig { override.returns(String) } + def inspect; end # def message: () -> String? # - # source://prism//lib/prism/node.rb#3184 + # source://prism//lib/prism/node.rb#3213 sig { returns(T.nilable(String)) } def message; end - # attr_reader message_loc: Location? + # Represents the location of the message. + # + # foo.bar ||= value + # ^^^ # - # source://prism//lib/prism/node.rb#3130 + # source://prism//lib/prism/node.rb#3155 sig { returns(T.nilable(Prism::Location)) } def message_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#3189 + # source://prism//lib/prism/node.rb#3218 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the operator. + # + # foo.bar ||= value + # ^^^ # - # source://prism//lib/prism/node.rb#3149 + # source://prism//lib/prism/node.rb#3189 sig { returns(Prism::Location) } def operator_loc; end - # attr_reader read_name: Symbol + # Represents the name of the method being called. + # + # foo.bar ||= value # read_name `:bar` + # ^^^ # - # source://prism//lib/prism/node.rb#3143 + # source://prism//lib/prism/node.rb#3177 sig { returns(Symbol) } def read_name; end - # attr_reader receiver: Prism::node? + # The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#3114 + # foo.bar ||= value + # ^^^ + # + # source://prism//lib/prism/node.rb#3127 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -3702,32 +3907,40 @@ class Prism::CallOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3159 + # source://prism//lib/prism/node.rb#3104 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#3147 + def save_call_operator_loc(repository); end + + # Save the message_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#3169 + def save_message_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#3197 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # # source://prism//lib/prism/node.rb#3228 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # Represents the value being assigned. + # + # foo.bar ||= value + # ^^^^^ # - # source://prism//lib/prism/node.rb#3156 + # source://prism//lib/prism/node.rb#3205 sig { returns(Prism::Node) } def value; end @@ -3735,33 +3948,23 @@ class Prism::CallOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3164 + # source://prism//lib/prism/node.rb#3109 sig { returns(T::Boolean) } def variable_call?; end - # attr_reader write_name: Symbol + # Represents the name of the method being written to. + # + # foo.bar ||= value # write_name `:bar=` + # ^^^ # - # source://prism//lib/prism/node.rb#3146 + # source://prism//lib/prism/node.rb#3183 sig { returns(Symbol) } def write_name; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#3110 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#3238 + # source://prism//lib/prism/node.rb#3233 def type; end end end @@ -3779,35 +3982,36 @@ end # for foo.bar in baz do end # ^^^^^^^ # -# source://prism//lib/prism/node.rb#3269 +# source://prism//lib/prism/node.rb#3264 class Prism::CallTargetNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node receiver, Location call_operator_loc, Symbol name, Location message_loc, Location location) -> void + # Initialize a new CallTargetNode node. # # @return [CallTargetNode] a new instance of CallTargetNode # - # source://prism//lib/prism/node.rb#3271 + # source://prism//lib/prism/node.rb#3266 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: Prism::Node, call_operator_loc: Prism::Location, name: Symbol, - message_loc: Prism::Location, - location: Prism::Location + message_loc: Prism::Location ).void end - def initialize(source, flags, receiver, call_operator_loc, name, message_loc, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3412 + # source://prism//lib/prism/node.rb#3401 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3283 + # source://prism//lib/prism/node.rb#3278 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -3815,65 +4019,69 @@ class Prism::CallTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3350 + # source://prism//lib/prism/node.rb#3321 sig { returns(T::Boolean) } def attribute_write?; end # def call_operator: () -> String # - # source://prism//lib/prism/node.rb#3360 + # source://prism//lib/prism/node.rb#3375 sig { returns(String) } def call_operator; end - # attr_reader call_operator_loc: Location + # Represents the location of the call operator. # - # source://prism//lib/prism/node.rb#3323 + # foo.bar = 1 + # ^ + # + # source://prism//lib/prism/node.rb#3340 sig { returns(Prism::Location) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3288 + # source://prism//lib/prism/node.rb#3283 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3298 + # source://prism//lib/prism/node.rb#3293 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3293 + # source://prism//lib/prism/node.rb#3288 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location, ?location: Location) -> CallTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode # - # source://prism//lib/prism/node.rb#3303 + # source://prism//lib/prism/node.rb#3298 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: Prism::Node, call_operator_loc: Prism::Location, name: Symbol, - message_loc: Prism::Location, - location: Prism::Location + message_loc: Prism::Location ).returns(Prism::CallTargetNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3288 + # source://prism//lib/prism/node.rb#3283 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node, call_operator_loc: Location, name: Symbol, message_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node, call_operator_loc: Location, name: Symbol, message_loc: Location } # - # source://prism//lib/prism/node.rb#3311 + # source://prism//lib/prism/node.rb#3306 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -3884,37 +4092,46 @@ class Prism::CallTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3355 + # source://prism//lib/prism/node.rb#3326 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3370 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3385 + sig { override.returns(String) } + def inspect; end # def message: () -> String # - # source://prism//lib/prism/node.rb#3365 + # source://prism//lib/prism/node.rb#3380 sig { returns(String) } def message; end - # attr_reader message_loc: Location + # Represents the location of the message. + # + # foo.bar = 1 + # ^^^ # - # source://prism//lib/prism/node.rb#3333 + # source://prism//lib/prism/node.rb#3362 sig { returns(Prism::Location) } def message_loc; end - # attr_reader name: Symbol + # Represents the name of the method being called. + # + # foo.bar = 1 # name `:foo` + # ^^^ # - # source://prism//lib/prism/node.rb#3330 + # source://prism//lib/prism/node.rb#3356 sig { returns(Symbol) } def name; end - # attr_reader receiver: Prism::node + # The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # foo.bar = 1 + # ^^^ # - # source://prism//lib/prism/node.rb#3320 + # source://prism//lib/prism/node.rb#3334 sig { returns(Prism::Node) } def receiver; end @@ -3922,26 +4139,25 @@ class Prism::CallTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3340 + # source://prism//lib/prism/node.rb#3311 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#3348 + def save_call_operator_loc(repository); end + + # Save the message_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#3370 + def save_message_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#3396 + # source://prism//lib/prism/node.rb#3390 sig { override.returns(Symbol) } def type; end @@ -3949,27 +4165,14 @@ class Prism::CallTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#3345 + # source://prism//lib/prism/node.rb#3316 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#3316 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#3406 + # source://prism//lib/prism/node.rb#3395 def type; end end end @@ -3979,141 +4182,142 @@ end # foo => [bar => baz] # ^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#3426 +# source://prism//lib/prism/node.rb#3415 class Prism::CapturePatternNode < ::Prism::Node - # def initialize: (Prism::node value, Prism::node target, Location operator_loc, Location location) -> void + # Initialize a new CapturePatternNode node. # # @return [CapturePatternNode] a new instance of CapturePatternNode # - # source://prism//lib/prism/node.rb#3428 + # source://prism//lib/prism/node.rb#3417 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, value: Prism::Node, - target: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + target: Prism::LocalVariableTargetNode, + operator_loc: Prism::Location ).void end - def initialize(source, value, target, operator_loc, location); end + def initialize(source, node_id, location, flags, value, target, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3529 + # source://prism//lib/prism/node.rb#3510 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3438 + # source://prism//lib/prism/node.rb#3428 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3443 + # source://prism//lib/prism/node.rb#3433 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3453 + # source://prism//lib/prism/node.rb#3443 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3448 + # source://prism//lib/prism/node.rb#3438 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Prism::node, ?target: Prism::node, ?operator_loc: Location, ?location: Location) -> CapturePatternNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode # - # source://prism//lib/prism/node.rb#3458 + # source://prism//lib/prism/node.rb#3448 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, value: Prism::Node, - target: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + target: Prism::LocalVariableTargetNode, + operator_loc: Prism::Location ).returns(Prism::CapturePatternNode) end - def copy(value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3443 + # source://prism//lib/prism/node.rb#3433 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Prism::node, target: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, target: LocalVariableTargetNode, operator_loc: Location } # - # source://prism//lib/prism/node.rb#3466 + # source://prism//lib/prism/node.rb#3456 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3489 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3494 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#3484 + # source://prism//lib/prism/node.rb#3489 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the `=>` operator. + # + # foo => bar + # ^^ # - # source://prism//lib/prism/node.rb#3477 + # source://prism//lib/prism/node.rb#3476 sig { returns(Prism::Location) } def operator_loc; end - # attr_reader target: Prism::node + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#3474 - sig { returns(Prism::Node) } - def target; end + # source://prism//lib/prism/node.rb#3484 + def save_operator_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Represents the target of the capture. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # foo => bar + # ^^^ # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#3470 + sig { returns(Prism::LocalVariableTargetNode) } + def target; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#3513 + # source://prism//lib/prism/node.rb#3499 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # Represents the value to capture. + # + # foo => bar + # ^^^ # - # source://prism//lib/prism/node.rb#3471 + # source://prism//lib/prism/node.rb#3464 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#3523 + # source://prism//lib/prism/node.rb#3504 def type; end end end @@ -4125,163 +4329,182 @@ end # end # ^^^^^^^^^ # -# source://prism//lib/prism/node.rb#3543 +# source://prism//lib/prism/node.rb#3524 class Prism::CaseMatchNode < ::Prism::Node - # def initialize: (Prism::node? predicate, Array[Prism::node] conditions, ElseNode? consequent, Location case_keyword_loc, Location end_keyword_loc, Location location) -> void + # Initialize a new CaseMatchNode node. # # @return [CaseMatchNode] a new instance of CaseMatchNode # - # source://prism//lib/prism/node.rb#3545 + # source://prism//lib/prism/node.rb#3526 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, predicate: T.nilable(Prism::Node), - conditions: T::Array[Prism::Node], - consequent: T.nilable(Prism::ElseNode), + conditions: T::Array[Prism::InNode], + else_clause: T.nilable(Prism::ElseNode), case_keyword_loc: Prism::Location, - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).void end - def initialize(source, predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3677 + # source://prism//lib/prism/node.rb#3652 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3557 + # source://prism//lib/prism/node.rb#3539 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def case_keyword: () -> String # - # source://prism//lib/prism/node.rb#3617 + # source://prism//lib/prism/node.rb#3626 sig { returns(String) } def case_keyword; end - # attr_reader case_keyword_loc: Location + # Represents the location of the `case` keyword. + # + # case true; in false; end + # ^^^^ # - # source://prism//lib/prism/node.rb#3603 + # source://prism//lib/prism/node.rb#3597 sig { returns(Prism::Location) } def case_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3562 + # source://prism//lib/prism/node.rb#3544 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3576 + # source://prism//lib/prism/node.rb#3558 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3567 + # source://prism//lib/prism/node.rb#3549 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader conditions: Array[Prism::node] + # Represents the conditions of the case match. # - # source://prism//lib/prism/node.rb#3597 - sig { returns(T::Array[Prism::Node]) } + # case true; in false; end + # ^^^^^^^^ + # + # source://prism//lib/prism/node.rb#3585 + sig { returns(T::Array[Prism::InNode]) } def conditions; end - # attr_reader consequent: ElseNode? + # Returns the else clause of the case match node. This method is deprecated + # in favor of #else_clause. # - # source://prism//lib/prism/node.rb#3600 - sig { returns(T.nilable(Prism::ElseNode)) } + # source://prism//lib/prism/node_ext.rb#467 def consequent; end - # def copy: (?predicate: Prism::node?, ?conditions: Array[Prism::node], ?consequent: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location, ?location: Location) -> CaseMatchNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode # - # source://prism//lib/prism/node.rb#3581 + # source://prism//lib/prism/node.rb#3563 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, predicate: T.nilable(Prism::Node), - conditions: T::Array[Prism::Node], - consequent: T.nilable(Prism::ElseNode), + conditions: T::Array[Prism::InNode], + else_clause: T.nilable(Prism::ElseNode), case_keyword_loc: Prism::Location, - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).returns(Prism::CaseMatchNode) end - def copy(predicate: T.unsafe(nil), conditions: T.unsafe(nil), consequent: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3562 + # source://prism//lib/prism/node.rb#3544 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { predicate: Prism::node?, conditions: Array[Prism::node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, predicate: Prism::node?, conditions: Array[InNode], else_clause: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location } # - # source://prism//lib/prism/node.rb#3589 + # source://prism//lib/prism/node.rb#3571 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # Represents the else clause of the case match. + # + # case true; in false; else; end + # ^^^^ + # + # source://prism//lib/prism/node.rb#3591 + sig { returns(T.nilable(Prism::ElseNode)) } + def else_clause; end + # def end_keyword: () -> String # - # source://prism//lib/prism/node.rb#3622 + # source://prism//lib/prism/node.rb#3631 sig { returns(String) } def end_keyword; end - # attr_reader end_keyword_loc: Location + # Represents the location of the `end` keyword. + # + # case true; in false; end + # ^^^ # - # source://prism//lib/prism/node.rb#3610 + # source://prism//lib/prism/node.rb#3613 sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3627 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3636 + sig { override.returns(String) } + def inspect; end - # attr_reader predicate: Prism::node? + # Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # case true; in false; end + # ^^^^ # - # source://prism//lib/prism/node.rb#3594 + # source://prism//lib/prism/node.rb#3579 sig { returns(T.nilable(Prism::Node)) } def predicate; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the case_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#3605 + def save_case_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#3621 + def save_end_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#3661 + # source://prism//lib/prism/node.rb#3641 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#3671 + # source://prism//lib/prism/node.rb#3646 def type; end end end @@ -4293,163 +4516,182 @@ end # end # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#3694 +# source://prism//lib/prism/node.rb#3669 class Prism::CaseNode < ::Prism::Node - # def initialize: (Prism::node? predicate, Array[Prism::node] conditions, ElseNode? consequent, Location case_keyword_loc, Location end_keyword_loc, Location location) -> void + # Initialize a new CaseNode node. # # @return [CaseNode] a new instance of CaseNode # - # source://prism//lib/prism/node.rb#3696 + # source://prism//lib/prism/node.rb#3671 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, predicate: T.nilable(Prism::Node), - conditions: T::Array[Prism::Node], - consequent: T.nilable(Prism::ElseNode), + conditions: T::Array[Prism::WhenNode], + else_clause: T.nilable(Prism::ElseNode), case_keyword_loc: Prism::Location, - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).void end - def initialize(source, predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#3828 + # source://prism//lib/prism/node.rb#3797 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3708 + # source://prism//lib/prism/node.rb#3684 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def case_keyword: () -> String # - # source://prism//lib/prism/node.rb#3768 + # source://prism//lib/prism/node.rb#3771 sig { returns(String) } def case_keyword; end - # attr_reader case_keyword_loc: Location + # Represents the location of the `case` keyword. + # + # case true; when false; end + # ^^^^ # - # source://prism//lib/prism/node.rb#3754 + # source://prism//lib/prism/node.rb#3742 sig { returns(Prism::Location) } def case_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3713 + # source://prism//lib/prism/node.rb#3689 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3727 + # source://prism//lib/prism/node.rb#3703 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3718 + # source://prism//lib/prism/node.rb#3694 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader conditions: Array[Prism::node] + # Represents the conditions of the case statement. # - # source://prism//lib/prism/node.rb#3748 - sig { returns(T::Array[Prism::Node]) } + # case true; when false; end + # ^^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#3730 + sig { returns(T::Array[Prism::WhenNode]) } def conditions; end - # attr_reader consequent: ElseNode? + # Returns the else clause of the case node. This method is deprecated in + # favor of #else_clause. # - # source://prism//lib/prism/node.rb#3751 - sig { returns(T.nilable(Prism::ElseNode)) } + # source://prism//lib/prism/node_ext.rb#476 def consequent; end - # def copy: (?predicate: Prism::node?, ?conditions: Array[Prism::node], ?consequent: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location, ?location: Location) -> CaseNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode # - # source://prism//lib/prism/node.rb#3732 + # source://prism//lib/prism/node.rb#3708 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, predicate: T.nilable(Prism::Node), - conditions: T::Array[Prism::Node], - consequent: T.nilable(Prism::ElseNode), + conditions: T::Array[Prism::WhenNode], + else_clause: T.nilable(Prism::ElseNode), case_keyword_loc: Prism::Location, - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).returns(Prism::CaseNode) end - def copy(predicate: T.unsafe(nil), conditions: T.unsafe(nil), consequent: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3713 + # source://prism//lib/prism/node.rb#3689 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { predicate: Prism::node?, conditions: Array[Prism::node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, predicate: Prism::node?, conditions: Array[WhenNode], else_clause: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location } # - # source://prism//lib/prism/node.rb#3740 + # source://prism//lib/prism/node.rb#3716 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def end_keyword: () -> String + # Represents the else clause of the case statement. # - # source://prism//lib/prism/node.rb#3773 - sig { returns(String) } + # case true; when false; else; end + # ^^^^ + # + # source://prism//lib/prism/node.rb#3736 + sig { returns(T.nilable(Prism::ElseNode)) } + def else_clause; end + + # def end_keyword: () -> String + # + # source://prism//lib/prism/node.rb#3776 + sig { returns(String) } def end_keyword; end - # attr_reader end_keyword_loc: Location + # Represents the location of the `end` keyword. # - # source://prism//lib/prism/node.rb#3761 + # case true; when false; end + # ^^^ + # + # source://prism//lib/prism/node.rb#3758 sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3778 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3781 + sig { override.returns(String) } + def inspect; end - # attr_reader predicate: Prism::node? + # Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # case true; when false; end + # ^^^^ # - # source://prism//lib/prism/node.rb#3745 + # source://prism//lib/prism/node.rb#3724 sig { returns(T.nilable(Prism::Node)) } def predicate; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the case_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#3750 + def save_case_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#3766 + def save_end_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#3812 + # source://prism//lib/prism/node.rb#3786 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#3822 + # source://prism//lib/prism/node.rb#3791 def type; end end end @@ -4459,123 +4701,127 @@ end # class Foo end # ^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#3843 +# source://prism//lib/prism/node.rb#3812 class Prism::ClassNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, Location class_keyword_loc, Prism::node constant_path, Location? inheritance_operator_loc, Prism::node? superclass, Prism::node? body, Location end_keyword_loc, Symbol name, Location location) -> void + # Initialize a new ClassNode node. # # @return [ClassNode] a new instance of ClassNode # - # source://prism//lib/prism/node.rb#3845 + # source://prism//lib/prism/node.rb#3814 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Prism::Location, - constant_path: Prism::Node, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode), inheritance_operator_loc: T.nilable(Prism::Location), superclass: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), end_keyword_loc: Prism::Location, - name: Symbol, - location: Prism::Location + name: Symbol ).void end - def initialize(source, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location); end + def initialize(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4008 + # source://prism//lib/prism/node.rb#3958 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#3860 + # source://prism//lib/prism/node.rb#3830 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? + # attr_reader body: StatementsNode | BeginNode | nil # - # source://prism//lib/prism/node.rb#3926 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#3908 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3865 + # source://prism//lib/prism/node.rb#3835 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def class_keyword: () -> String # - # source://prism//lib/prism/node.rb#3939 + # source://prism//lib/prism/node.rb#3927 sig { returns(String) } def class_keyword; end # attr_reader class_keyword_loc: Location # - # source://prism//lib/prism/node.rb#3900 + # source://prism//lib/prism/node.rb#3870 sig { returns(Prism::Location) } def class_keyword_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#3879 + # source://prism//lib/prism/node.rb#3849 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#3870 + # source://prism//lib/prism/node.rb#3840 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader constant_path: Prism::node + # attr_reader constant_path: ConstantReadNode | ConstantPathNode | CallNode # - # source://prism//lib/prism/node.rb#3907 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#3883 + sig { returns(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode)) } def constant_path; end - # def copy: (?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: Prism::node, ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: Prism::node?, ?end_keyword_loc: Location, ?name: Symbol, ?location: Location) -> ClassNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode | CallNode, ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode # - # source://prism//lib/prism/node.rb#3884 + # source://prism//lib/prism/node.rb#3854 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Prism::Location, - constant_path: Prism::Node, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode), inheritance_operator_loc: T.nilable(Prism::Location), superclass: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), end_keyword_loc: Prism::Location, - name: Symbol, - location: Prism::Location + name: Symbol ).returns(Prism::ClassNode) end - def copy(locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#3865 + # source://prism//lib/prism/node.rb#3835 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], class_keyword_loc: Location, constant_path: Prism::node, inheritance_operator_loc: Location?, superclass: Prism::node?, body: Prism::node?, end_keyword_loc: Location, name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], class_keyword_loc: Location, constant_path: ConstantReadNode | ConstantPathNode | CallNode, inheritance_operator_loc: Location?, superclass: Prism::node?, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#3892 + # source://prism//lib/prism/node.rb#3862 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # - # source://prism//lib/prism/node.rb#3949 + # source://prism//lib/prism/node.rb#3937 sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # - # source://prism//lib/prism/node.rb#3929 + # source://prism//lib/prism/node.rb#3911 sig { returns(Prism::Location) } def end_keyword_loc; end @@ -4584,68 +4830,68 @@ class Prism::ClassNode < ::Prism::Node # def inheritance_operator: () -> String? # - # source://prism//lib/prism/node.rb#3944 + # source://prism//lib/prism/node.rb#3932 sig { returns(T.nilable(String)) } def inheritance_operator; end # attr_reader inheritance_operator_loc: Location? # - # source://prism//lib/prism/node.rb#3910 + # source://prism//lib/prism/node.rb#3886 sig { returns(T.nilable(Prism::Location)) } def inheritance_operator_loc; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#3954 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#3942 + sig { override.returns(String) } + def inspect; end # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/node.rb#3897 + # source://prism//lib/prism/node.rb#3867 sig { returns(T::Array[Symbol]) } def locals; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#3936 + # source://prism//lib/prism/node.rb#3924 sig { returns(Symbol) } def name; end + # Save the class_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#3878 + def save_class_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#3919 + def save_end_keyword_loc(repository); end + + # Save the inheritance_operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#3900 + def save_inheritance_operator_loc(repository); end + # attr_reader superclass: Prism::node? # - # source://prism//lib/prism/node.rb#3923 + # source://prism//lib/prism/node.rb#3905 sig { returns(T.nilable(Prism::Node)) } def superclass; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#3992 + # source://prism//lib/prism/node.rb#3947 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4002 + # source://prism//lib/prism/node.rb#3952 def type; end end end @@ -4655,152 +4901,162 @@ end # @@target &&= value # ^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4026 +# source://prism//lib/prism/node.rb#3976 class Prism::ClassVariableAndWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ClassVariableAndWriteNode node. # # @return [ClassVariableAndWriteNode] a new instance of ClassVariableAndWriteNode # - # source://prism//lib/prism/node.rb#4028 + # source://prism//lib/prism/node.rb#3978 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4137 + # source://prism//lib/prism/node.rb#4088 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4039 + # source://prism//lib/prism/node.rb#3990 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4044 + # source://prism//lib/prism/node.rb#3995 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4054 + # source://prism//lib/prism/node.rb#4005 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4049 + # source://prism//lib/prism/node.rb#4000 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ClassVariableAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode # - # source://prism//lib/prism/node.rb#4059 + # source://prism//lib/prism/node.rb#4010 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ClassVariableAndWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4044 + # source://prism//lib/prism/node.rb#3995 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#4067 + # source://prism//lib/prism/node.rb#4018 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#127 + # source://prism//lib/prism/desugar_compiler.rb#164 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4097 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4072 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # - # source://prism//lib/prism/node.rb#4072 + # @@target &&= value # name `:@@target` + # ^^^^^^^^ + # + # source://prism//lib/prism/node.rb#4026 sig { returns(Symbol) } def name; end - # attr_reader name_loc: Location + # Represents the location of the variable name. + # + # @@target &&= value + # ^^^^^^^^ # - # source://prism//lib/prism/node.rb#4075 + # source://prism//lib/prism/node.rb#4032 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#4092 + # source://prism//lib/prism/node.rb#4067 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # Represents the location of the `&&=` operator. + # + # @@target &&= value + # ^^^ # - # source://prism//lib/prism/node.rb#4082 + # source://prism//lib/prism/node.rb#4048 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4040 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4056 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4121 + # source://prism//lib/prism/node.rb#4077 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#4089 + # @@target &&= value + # ^^^^^ + # + # source://prism//lib/prism/node.rb#4064 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4131 + # source://prism//lib/prism/node.rb#4082 def type; end end end @@ -4810,154 +5066,164 @@ end # @@target += value # ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4150 +# source://prism//lib/prism/node.rb#4101 class Prism::ClassVariableOperatorWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Symbol operator, Location location) -> void + # Initialize a new ClassVariableOperatorWriteNode node. # # @return [ClassVariableOperatorWriteNode] a new instance of ClassVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#4152 + # source://prism//lib/prism/node.rb#4103 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).void end - def initialize(source, name, name_loc, operator_loc, value, operator, location); end + def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4261 + # source://prism//lib/prism/node.rb#4200 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4164 + # source://prism//lib/prism/node.rb#4116 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader binary_operator: Symbol + # + # source://prism//lib/prism/node.rb#4181 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#4165 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4169 + # source://prism//lib/prism/node.rb#4121 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4179 + # source://prism//lib/prism/node.rb#4131 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4174 + # source://prism//lib/prism/node.rb#4126 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?operator: Symbol, ?location: Location) -> ClassVariableOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#4184 + # source://prism//lib/prism/node.rb#4136 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).returns(Prism::ClassVariableOperatorWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), operator: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4169 + # source://prism//lib/prism/node.rb#4121 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, operator: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # - # source://prism//lib/prism/node.rb#4192 + # source://prism//lib/prism/node.rb#4144 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#139 + # source://prism//lib/prism/desugar_compiler.rb#176 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4220 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4184 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#4197 + # source://prism//lib/prism/node.rb#4149 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#4200 + # source://prism//lib/prism/node.rb#4152 sig { returns(Prism::Location) } def name_loc; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#4217 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#355 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#4207 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#362 def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4173 + def save_binary_operator_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4160 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4245 + # source://prism//lib/prism/node.rb#4189 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#4214 + # source://prism//lib/prism/node.rb#4178 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#4255 + # source://prism//lib/prism/node.rb#4194 def type; end end end @@ -4967,152 +5233,150 @@ end # @@target ||= value # ^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4275 +# source://prism//lib/prism/node.rb#4214 class Prism::ClassVariableOrWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ClassVariableOrWriteNode node. # # @return [ClassVariableOrWriteNode] a new instance of ClassVariableOrWriteNode # - # source://prism//lib/prism/node.rb#4277 + # source://prism//lib/prism/node.rb#4216 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4386 + # source://prism//lib/prism/node.rb#4314 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4288 + # source://prism//lib/prism/node.rb#4228 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4293 + # source://prism//lib/prism/node.rb#4233 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4303 + # source://prism//lib/prism/node.rb#4243 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4298 + # source://prism//lib/prism/node.rb#4238 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ClassVariableOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode # - # source://prism//lib/prism/node.rb#4308 + # source://prism//lib/prism/node.rb#4248 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ClassVariableOrWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4293 + # source://prism//lib/prism/node.rb#4233 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#4316 + # source://prism//lib/prism/node.rb#4256 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#133 + # source://prism//lib/prism/desugar_compiler.rb#170 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4346 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4298 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#4321 + # source://prism//lib/prism/node.rb#4261 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#4324 + # source://prism//lib/prism/node.rb#4264 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#4341 + # source://prism//lib/prism/node.rb#4293 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#4331 + # source://prism//lib/prism/node.rb#4277 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4272 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4285 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4370 + # source://prism//lib/prism/node.rb#4303 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#4338 + # source://prism//lib/prism/node.rb#4290 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4380 + # source://prism//lib/prism/node.rb#4308 def type; end end end @@ -5122,73 +5386,80 @@ end # @@foo # ^^^^^ # -# source://prism//lib/prism/node.rb#4399 +# source://prism//lib/prism/node.rb#4327 class Prism::ClassVariableReadNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new ClassVariableReadNode node. # # @return [ClassVariableReadNode] a new instance of ClassVariableReadNode # - # source://prism//lib/prism/node.rb#4401 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#4329 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4485 + # source://prism//lib/prism/node.rb#4394 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4409 + # source://prism//lib/prism/node.rb#4338 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4414 + # source://prism//lib/prism/node.rb#4343 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4424 + # source://prism//lib/prism/node.rb#4353 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4419 + # source://prism//lib/prism/node.rb#4348 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> ClassVariableReadNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode # - # source://prism//lib/prism/node.rb#4429 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::ClassVariableReadNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4358 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableReadNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4414 + # source://prism//lib/prism/node.rb#4343 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#4437 + # source://prism//lib/prism/node.rb#4366 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4449 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4378 + sig { override.returns(String) } + def inspect; end # The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # @@ -5196,38 +5467,20 @@ class Prism::ClassVariableReadNode < ::Prism::Node # # @@_test # name `:@@_test` # - # source://prism//lib/prism/node.rb#4446 + # source://prism//lib/prism/node.rb#4375 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#4469 + # source://prism//lib/prism/node.rb#4383 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4479 + # source://prism//lib/prism/node.rb#4388 def type; end end end @@ -5237,108 +5490,97 @@ end # @@foo, @@bar = baz # ^^^^^ ^^^^^ # -# source://prism//lib/prism/node.rb#4495 +# source://prism//lib/prism/node.rb#4404 class Prism::ClassVariableTargetNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new ClassVariableTargetNode node. # # @return [ClassVariableTargetNode] a new instance of ClassVariableTargetNode # - # source://prism//lib/prism/node.rb#4497 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#4406 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4577 + # source://prism//lib/prism/node.rb#4467 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4505 + # source://prism//lib/prism/node.rb#4415 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4510 + # source://prism//lib/prism/node.rb#4420 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4520 + # source://prism//lib/prism/node.rb#4430 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4515 + # source://prism//lib/prism/node.rb#4425 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> ClassVariableTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode # - # source://prism//lib/prism/node.rb#4525 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::ClassVariableTargetNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4435 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableTargetNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4510 + # source://prism//lib/prism/node.rb#4420 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#4533 + # source://prism//lib/prism/node.rb#4443 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4541 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4451 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#4538 + # source://prism//lib/prism/node.rb#4448 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#4561 + # source://prism//lib/prism/node.rb#4456 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4571 + # source://prism//lib/prism/node.rb#4461 def type; end end end @@ -5348,90 +5590,94 @@ end # @@foo = 1 # ^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4587 +# source://prism//lib/prism/node.rb#4477 class Prism::ClassVariableWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Prism::node value, Location operator_loc, Location location) -> void + # Initialize a new ClassVariableWriteNode node. # # @return [ClassVariableWriteNode] a new instance of ClassVariableWriteNode # - # source://prism//lib/prism/node.rb#4589 + # source://prism//lib/prism/node.rb#4479 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, name, name_loc, value, operator_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4714 + # source://prism//lib/prism/node.rb#4593 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4600 + # source://prism//lib/prism/node.rb#4491 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4605 + # source://prism//lib/prism/node.rb#4496 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4615 + # source://prism//lib/prism/node.rb#4506 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4610 + # source://prism//lib/prism/node.rb#4501 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location, ?location: Location) -> ClassVariableWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode # - # source://prism//lib/prism/node.rb#4620 + # source://prism//lib/prism/node.rb#4511 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::ClassVariableWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4605 + # source://prism//lib/prism/node.rb#4496 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#4628 + # source://prism//lib/prism/node.rb#4519 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4674 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4577 + sig { override.returns(String) } + def inspect; end # The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # @@ -5439,7 +5685,7 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # # @@_test = :test # name `@@_test` # - # source://prism//lib/prism/node.rb#4637 + # source://prism//lib/prism/node.rb#4528 sig { returns(Symbol) } def name; end @@ -5448,13 +5694,13 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # @@foo = :bar # ^^^^^ # - # source://prism//lib/prism/node.rb#4643 + # source://prism//lib/prism/node.rb#4534 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#4669 + # source://prism//lib/prism/node.rb#4572 sig { returns(String) } def operator; end @@ -5463,26 +5709,25 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # @@foo = :bar # ^ # - # source://prism//lib/prism/node.rb#4662 + # source://prism//lib/prism/node.rb#4559 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4542 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4567 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4698 + # source://prism//lib/prism/node.rb#4582 sig { override.returns(Symbol) } def type; end @@ -5494,27 +5739,75 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # @@_xyz = 123 # ^^^ # - # source://prism//lib/prism/node.rb#4656 + # source://prism//lib/prism/node.rb#4553 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#4708 + # source://prism//lib/prism/node.rb#4587 def type; end end end +# A cache that can be used to quickly compute code unit offsets from byte +# offsets. It purposefully provides only a single #[] method to access the +# cache in order to minimize surface area. +# +# Note that there are some known issues here that may or may not be addressed +# in the future: +# +# * The first is that there are issues when the cache computes values that are +# not on character boundaries. This can result in subsequent computations +# being off by one or more code units. +# * The second is that this cache is currently unbounded. In theory we could +# introduce some kind of LRU cache to limit the number of entries, but this +# has not yet been implemented. +# +# source://prism//lib/prism/parse_result.rb#189 +class Prism::CodeUnitsCache + # Initialize a new cache with the given source and encoding. + # + # @return [CodeUnitsCache] a new instance of CodeUnitsCache + # + # source://prism//lib/prism/parse_result.rb#215 + sig { params(source: String, encoding: Encoding).void } + def initialize(source, encoding); end + + # Retrieve the code units offset from the given byte offset. + # + # source://prism//lib/prism/parse_result.rb#229 + sig { params(byte_offset: Integer).returns(Integer) } + def [](byte_offset); end +end + +# source://prism//lib/prism/parse_result.rb#201 +class Prism::CodeUnitsCache::LengthCounter + # @return [LengthCounter] a new instance of LengthCounter + # + # source://prism//lib/prism/parse_result.rb#202 + def initialize(source, encoding); end + + # source://prism//lib/prism/parse_result.rb#207 + def count(byte_offset, byte_length); end +end + +# source://prism//lib/prism/parse_result.rb#190 +class Prism::CodeUnitsCache::UTF16Counter + # @return [UTF16Counter] a new instance of UTF16Counter + # + # source://prism//lib/prism/parse_result.rb#191 + def initialize(source, encoding); end + + # source://prism//lib/prism/parse_result.rb#196 + def count(byte_offset, byte_length); end +end + # This represents a comment that was encountered during parsing. It is the # base class for all comment types. # -# source://prism//lib/prism/parse_result.rb#288 +# source://prism//lib/prism/parse_result.rb#524 class Prism::Comment abstract! @@ -5522,25 +5815,25 @@ class Prism::Comment # # @return [Comment] a new instance of Comment # - # source://prism//lib/prism/parse_result.rb#293 + # source://prism//lib/prism/parse_result.rb#529 sig { params(location: Prism::Location).void } def initialize(location); end # Implement the hash pattern matching interface for Comment. # - # source://prism//lib/prism/parse_result.rb#298 + # source://prism//lib/prism/parse_result.rb#534 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The location of this comment in the source. # - # source://prism//lib/prism/parse_result.rb#290 + # source://prism//lib/prism/parse_result.rb#526 sig { returns(Prism::Location) } def location; end # Returns the content of the comment by slicing it from the source code. # - # source://prism//lib/prism/parse_result.rb#303 + # source://prism//lib/prism/parse_result.rb#539 sig { returns(String) } def slice; end @@ -5570,7 +5863,7 @@ class Prism::Compiler < ::Prism::Visitor # Visit an individual node. # # source://prism//lib/prism/compiler.rb#29 - sig { params(node: T.nilable(Prism::Node)).returns(T.nilable(Result)) } + sig { params(node: T.nilable(Prism::Node)).returns(T.untyped) } def visit(node); end # Visit the child nodes of the given node. @@ -5588,7 +5881,7 @@ class Prism::Compiler < ::Prism::Visitor # Visit a list of nodes. # # source://prism//lib/prism/compiler.rb#34 - sig { params(nodes: T::Array[T.nilable(Prism::Node)]).returns(T::Array[T.nilable(Result)]) } + sig { params(nodes: T::Array[T.nilable(Prism::Node)]).returns(T::Array[T.untyped]) } def visit_all(nodes); end # Visit the child nodes of the given node. @@ -5732,7 +6025,7 @@ class Prism::Compiler < ::Prism::Visitor # Visit the child nodes of the given node. # # source://prism//lib/prism/compiler.rb#39 - sig { params(node: Prism::Node).returns(T::Array[T.nilable(Result)]) } + sig { params(node: Prism::Node).returns(T::Array[T.untyped]) } def visit_child_nodes(node); end # Visit the child nodes of the given node. @@ -6107,6 +6400,12 @@ class Prism::Compiler < ::Prism::Visitor # source://prism//lib/prism/compiler.rb#39 def visit_interpolated_x_string_node(node); end + # Visit the child nodes of the given node. + # Compile a ItLocalVariableReadNode node + # + # source://prism//lib/prism/compiler.rb#39 + def visit_it_local_variable_read_node(node); end + # Visit the child nodes of the given node. # Compile a ItParametersNode node # @@ -6484,8 +6783,6 @@ class Prism::Compiler < ::Prism::Visitor # # source://prism//lib/prism/compiler.rb#39 def visit_yield_node(node); end - - Result = type_member end # Represents the use of the `&&=` operator for assignment to a constant. @@ -6493,152 +6790,150 @@ end # Target &&= value # ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4727 +# source://prism//lib/prism/node.rb#4606 class Prism::ConstantAndWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ConstantAndWriteNode node. # # @return [ConstantAndWriteNode] a new instance of ConstantAndWriteNode # - # source://prism//lib/prism/node.rb#4729 + # source://prism//lib/prism/node.rb#4608 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4838 + # source://prism//lib/prism/node.rb#4706 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4740 + # source://prism//lib/prism/node.rb#4620 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4745 + # source://prism//lib/prism/node.rb#4625 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4755 + # source://prism//lib/prism/node.rb#4635 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4750 + # source://prism//lib/prism/node.rb#4630 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ConstantAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode # - # source://prism//lib/prism/node.rb#4760 + # source://prism//lib/prism/node.rb#4640 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ConstantAndWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4745 + # source://prism//lib/prism/node.rb#4625 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#4768 + # source://prism//lib/prism/node.rb#4648 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#145 + # source://prism//lib/prism/desugar_compiler.rb#182 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4798 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4690 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#4773 + # source://prism//lib/prism/node.rb#4653 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#4776 + # source://prism//lib/prism/node.rb#4656 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#4793 + # source://prism//lib/prism/node.rb#4685 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#4783 + # source://prism//lib/prism/node.rb#4669 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4664 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4677 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4822 + # source://prism//lib/prism/node.rb#4695 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#4790 + # source://prism//lib/prism/node.rb#4682 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#4832 + # source://prism//lib/prism/node.rb#4700 def type; end end end @@ -6648,154 +6943,164 @@ end # Target += value # ^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4851 +# source://prism//lib/prism/node.rb#4719 class Prism::ConstantOperatorWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Symbol operator, Location location) -> void + # Initialize a new ConstantOperatorWriteNode node. # # @return [ConstantOperatorWriteNode] a new instance of ConstantOperatorWriteNode # - # source://prism//lib/prism/node.rb#4853 + # source://prism//lib/prism/node.rb#4721 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).void end - def initialize(source, name, name_loc, operator_loc, value, operator, location); end + def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#4962 + # source://prism//lib/prism/node.rb#4818 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4865 + # source://prism//lib/prism/node.rb#4734 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader binary_operator: Symbol + # + # source://prism//lib/prism/node.rb#4799 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#4783 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4870 + # source://prism//lib/prism/node.rb#4739 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#4880 + # source://prism//lib/prism/node.rb#4749 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4875 + # source://prism//lib/prism/node.rb#4744 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?operator: Symbol, ?location: Location) -> ConstantOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode # - # source://prism//lib/prism/node.rb#4885 + # source://prism//lib/prism/node.rb#4754 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).returns(Prism::ConstantOperatorWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), operator: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4870 + # source://prism//lib/prism/node.rb#4739 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, operator: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # - # source://prism//lib/prism/node.rb#4893 + # source://prism//lib/prism/node.rb#4762 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#157 + # source://prism//lib/prism/desugar_compiler.rb#194 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#4921 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4802 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#4898 + # source://prism//lib/prism/node.rb#4767 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#4901 + # source://prism//lib/prism/node.rb#4770 sig { returns(Prism::Location) } def name_loc; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#4918 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#371 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#4908 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#378 def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4791 + def save_binary_operator_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4778 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#4946 + # source://prism//lib/prism/node.rb#4807 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#4915 + # source://prism//lib/prism/node.rb#4796 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#4956 + # source://prism//lib/prism/node.rb#4812 def type; end end end @@ -6805,152 +7110,150 @@ end # Target ||= value # ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#4976 +# source://prism//lib/prism/node.rb#4832 class Prism::ConstantOrWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ConstantOrWriteNode node. # # @return [ConstantOrWriteNode] a new instance of ConstantOrWriteNode # - # source://prism//lib/prism/node.rb#4978 + # source://prism//lib/prism/node.rb#4834 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5087 + # source://prism//lib/prism/node.rb#4932 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#4989 + # source://prism//lib/prism/node.rb#4846 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4994 + # source://prism//lib/prism/node.rb#4851 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5004 + # source://prism//lib/prism/node.rb#4861 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#4999 + # source://prism//lib/prism/node.rb#4856 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ConstantOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode # - # source://prism//lib/prism/node.rb#5009 + # source://prism//lib/prism/node.rb#4866 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ConstantOrWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#4994 + # source://prism//lib/prism/node.rb#4851 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#5017 + # source://prism//lib/prism/node.rb#4874 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#151 + # source://prism//lib/prism/desugar_compiler.rb#188 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5047 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#4916 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#5022 + # source://prism//lib/prism/node.rb#4879 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#5025 + # source://prism//lib/prism/node.rb#4882 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#5042 + # source://prism//lib/prism/node.rb#4911 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#5032 + # source://prism//lib/prism/node.rb#4895 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#4890 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#4903 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#5071 + # source://prism//lib/prism/node.rb#4921 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#5039 + # source://prism//lib/prism/node.rb#4908 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5081 + # source://prism//lib/prism/node.rb#4926 def type; end end end @@ -6960,141 +7263,133 @@ end # Parent::Child &&= value # ^^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#5100 +# source://prism//lib/prism/node.rb#4945 class Prism::ConstantPathAndWriteNode < ::Prism::Node - # def initialize: (ConstantPathNode target, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ConstantPathAndWriteNode node. # # @return [ConstantPathAndWriteNode] a new instance of ConstantPathAndWriteNode # - # source://prism//lib/prism/node.rb#5102 + # source://prism//lib/prism/node.rb#4947 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, target, operator_loc, value, location); end + def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5203 + # source://prism//lib/prism/node.rb#5031 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5112 + # source://prism//lib/prism/node.rb#4958 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5117 + # source://prism//lib/prism/node.rb#4963 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5127 + # source://prism//lib/prism/node.rb#4973 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5122 + # source://prism//lib/prism/node.rb#4968 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ConstantPathAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode # - # source://prism//lib/prism/node.rb#5132 + # source://prism//lib/prism/node.rb#4978 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ConstantPathAndWriteNode) end - def copy(target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5117 + # source://prism//lib/prism/node.rb#4963 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#5140 + # source://prism//lib/prism/node.rb#4986 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5163 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5015 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#5158 + # source://prism//lib/prism/node.rb#5010 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#5148 + # source://prism//lib/prism/node.rb#4994 sig { returns(Prism::Location) } def operator_loc; end + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#5002 + def save_operator_loc(repository); end + # attr_reader target: ConstantPathNode # - # source://prism//lib/prism/node.rb#5145 + # source://prism//lib/prism/node.rb#4991 sig { returns(Prism::ConstantPathNode) } def target; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5187 + # source://prism//lib/prism/node.rb#5020 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#5155 + # source://prism//lib/prism/node.rb#5007 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5197 + # source://prism//lib/prism/node.rb#5025 def type; end end end @@ -7104,99 +7399,96 @@ end # Foo::Bar # ^^^^^^^^ # -# source://prism//lib/prism/node.rb#5215 +# source://prism//lib/prism/node.rb#5043 class Prism::ConstantPathNode < ::Prism::Node - # def initialize: (Prism::node? parent, ConstantReadNode | MissingNode child, Location delimiter_loc, Location location) -> void + # Initialize a new ConstantPathNode node. # # @return [ConstantPathNode] a new instance of ConstantPathNode # - # source://prism//lib/prism/node.rb#5217 + # source://prism//lib/prism/node.rb#5045 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, parent: T.nilable(Prism::Node), - child: T.any(Prism::ConstantReadNode, Prism::MissingNode), + name: T.nilable(Symbol), delimiter_loc: Prism::Location, - location: Prism::Location + name_loc: Prism::Location ).void end - def initialize(source, parent, child, delimiter_loc, location); end + def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5350 + # source://prism//lib/prism/node.rb#5166 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5227 + # source://prism//lib/prism/node.rb#5057 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # The right-hand node of the path. Always a `ConstantReadNode` in a - # valid Ruby syntax tree. - # - # ::Foo - # ^^^ + # Previously, we had a child node on this class that contained either a + # constant read or a missing node. To not cause a breaking change, we + # continue to supply that API. # - # self::Test - # ^^^^ - # - # a.b::C - # ^ - # - # source://prism//lib/prism/node.rb#5285 - sig { returns(T.any(Prism::ConstantReadNode, Prism::MissingNode)) } + # source://prism//lib/prism/node_ext.rb#202 def child; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5232 + # source://prism//lib/prism/node.rb#5062 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5245 + # source://prism//lib/prism/node.rb#5074 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5237 + # source://prism//lib/prism/node.rb#5067 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?parent: Prism::node?, ?child: ConstantReadNode | MissingNode, ?delimiter_loc: Location, ?location: Location) -> ConstantPathNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode # - # source://prism//lib/prism/node.rb#5250 + # source://prism//lib/prism/node.rb#5079 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, parent: T.nilable(Prism::Node), - child: T.any(Prism::ConstantReadNode, Prism::MissingNode), + name: T.nilable(Symbol), delimiter_loc: Prism::Location, - location: Prism::Location + name_loc: Prism::Location ).returns(Prism::ConstantPathNode) end - def copy(parent: T.unsafe(nil), child: T.unsafe(nil), delimiter_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5232 + # source://prism//lib/prism/node.rb#5062 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?, child: ConstantReadNode | MissingNode, delimiter_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location } # - # source://prism//lib/prism/node.rb#5258 + # source://prism//lib/prism/node.rb#5087 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def delimiter: () -> String # - # source://prism//lib/prism/node.rb#5301 + # source://prism//lib/prism/node.rb#5145 sig { returns(String) } def delimiter; end @@ -7208,7 +7500,7 @@ class Prism::ConstantPathNode < ::Prism::Node # One::Two # ^^ # - # source://prism//lib/prism/node.rb#5294 + # source://prism//lib/prism/node.rb#5113 sig { returns(Prism::Location) } def delimiter_loc; end @@ -7217,22 +7509,40 @@ class Prism::ConstantPathNode < ::Prism::Node # Returns the full name of this constant path. For example: "Foo::Bar" # - # source://prism//lib/prism/node_ext.rb#162 + # source://prism//lib/prism/node_ext.rb#195 sig { returns(String) } def full_name; end # Returns the list of parts for the full name of this constant path. # For example: [:Foo, :Bar] # - # source://prism//lib/prism/node_ext.rb#141 + # source://prism//lib/prism/node_ext.rb#173 sig { returns(T::Array[Symbol]) } def full_name_parts; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#5150 + sig { override.returns(String) } + def inspect; end + + # The name of the constant being accessed. This could be `nil` in the event of a syntax error. + # + # source://prism//lib/prism/node.rb#5104 + sig { returns(T.nilable(Symbol)) } + def name; end + + # The location of the name of the constant. + # + # ::Foo + # ^^^ + # + # One::Two + # ^^^ # - # source://prism//lib/prism/node.rb#5306 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5132 + sig { returns(Prism::Location) } + def name_loc; end # The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree. # @@ -7245,38 +7555,32 @@ class Prism::ConstantPathNode < ::Prism::Node # a.b::C # ^^^ # - # source://prism//lib/prism/node.rb#5272 + # source://prism//lib/prism/node.rb#5101 sig { returns(T.nilable(Prism::Node)) } def parent; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the delimiter_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#5121 + def save_delimiter_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#5140 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#5334 + # source://prism//lib/prism/node.rb#5155 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5344 + # source://prism//lib/prism/node.rb#5160 def type; end end end @@ -7288,14 +7592,14 @@ end # var::Bar::Baz -> raises because the first part of the constant path is a # local variable # -# source://prism//lib/prism/node_ext.rb#132 +# source://prism//lib/prism/node_ext.rb#164 class Prism::ConstantPathNode::DynamicPartsInConstantPathError < ::StandardError; end # An error class raised when missing nodes are found while computing a # constant path's full name. For example: # Foo:: -> raises because the constant path is missing the last part # -# source://prism//lib/prism/node_ext.rb#137 +# source://prism//lib/prism/node_ext.rb#169 class Prism::ConstantPathNode::MissingNodesInConstantPathError < ::StandardError; end # Represents assigning to a constant path using an operator that isn't `=`. @@ -7303,143 +7607,147 @@ class Prism::ConstantPathNode::MissingNodesInConstantPathError < ::StandardError # Parent::Child += value # ^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#5362 +# source://prism//lib/prism/node.rb#5179 class Prism::ConstantPathOperatorWriteNode < ::Prism::Node - # def initialize: (ConstantPathNode target, Location operator_loc, Prism::node value, Symbol operator, Location location) -> void + # Initialize a new ConstantPathOperatorWriteNode node. # # @return [ConstantPathOperatorWriteNode] a new instance of ConstantPathOperatorWriteNode # - # source://prism//lib/prism/node.rb#5364 + # source://prism//lib/prism/node.rb#5181 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).void end - def initialize(source, target, operator_loc, value, operator, location); end + def initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5465 + # source://prism//lib/prism/node.rb#5264 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5375 + # source://prism//lib/prism/node.rb#5193 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader binary_operator: Symbol + # + # source://prism//lib/prism/node.rb#5245 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#5229 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5380 + # source://prism//lib/prism/node.rb#5198 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5390 + # source://prism//lib/prism/node.rb#5208 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5385 + # source://prism//lib/prism/node.rb#5203 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node, ?operator: Symbol, ?location: Location) -> ConstantPathOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode # - # source://prism//lib/prism/node.rb#5395 + # source://prism//lib/prism/node.rb#5213 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).returns(Prism::ConstantPathOperatorWriteNode) end - def copy(target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), operator: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5380 + # source://prism//lib/prism/node.rb#5198 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode, operator_loc: Location, value: Prism::node, operator: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # - # source://prism//lib/prism/node.rb#5403 + # source://prism//lib/prism/node.rb#5221 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5424 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5248 + sig { override.returns(String) } + def inspect; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#5421 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#387 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#5411 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#394 def operator_loc; end + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#5237 + def save_binary_operator_loc(repository); end + # attr_reader target: ConstantPathNode # - # source://prism//lib/prism/node.rb#5408 + # source://prism//lib/prism/node.rb#5226 sig { returns(Prism::ConstantPathNode) } def target; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5449 + # source://prism//lib/prism/node.rb#5253 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#5418 + # source://prism//lib/prism/node.rb#5242 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#5459 + # source://prism//lib/prism/node.rb#5258 def type; end end end @@ -7449,141 +7757,133 @@ end # Parent::Child ||= value # ^^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#5478 +# source://prism//lib/prism/node.rb#5277 class Prism::ConstantPathOrWriteNode < ::Prism::Node - # def initialize: (ConstantPathNode target, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ConstantPathOrWriteNode node. # # @return [ConstantPathOrWriteNode] a new instance of ConstantPathOrWriteNode # - # source://prism//lib/prism/node.rb#5480 + # source://prism//lib/prism/node.rb#5279 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, target, operator_loc, value, location); end + def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5581 + # source://prism//lib/prism/node.rb#5363 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5490 + # source://prism//lib/prism/node.rb#5290 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5495 + # source://prism//lib/prism/node.rb#5295 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5505 + # source://prism//lib/prism/node.rb#5305 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5500 + # source://prism//lib/prism/node.rb#5300 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ConstantPathOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode # - # source://prism//lib/prism/node.rb#5510 + # source://prism//lib/prism/node.rb#5310 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ConstantPathOrWriteNode) end - def copy(target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5495 + # source://prism//lib/prism/node.rb#5295 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#5518 + # source://prism//lib/prism/node.rb#5318 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5541 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5347 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#5536 + # source://prism//lib/prism/node.rb#5342 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#5526 + # source://prism//lib/prism/node.rb#5326 sig { returns(Prism::Location) } def operator_loc; end + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#5334 + def save_operator_loc(repository); end + # attr_reader target: ConstantPathNode # - # source://prism//lib/prism/node.rb#5523 + # source://prism//lib/prism/node.rb#5323 sig { returns(Prism::ConstantPathNode) } def target; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5565 + # source://prism//lib/prism/node.rb#5352 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#5533 + # source://prism//lib/prism/node.rb#5339 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#5575 + # source://prism//lib/prism/node.rb#5357 def type; end end end @@ -7593,95 +7893,102 @@ end # Foo::Foo, Bar::Bar = baz # ^^^^^^^^ ^^^^^^^^ # -# source://prism//lib/prism/node.rb#5593 +# source://prism//lib/prism/node.rb#5375 class Prism::ConstantPathTargetNode < ::Prism::Node - # def initialize: (Prism::node? parent, ConstantReadNode | MissingNode child, Location delimiter_loc, Location location) -> void + # Initialize a new ConstantPathTargetNode node. # # @return [ConstantPathTargetNode] a new instance of ConstantPathTargetNode # - # source://prism//lib/prism/node.rb#5595 + # source://prism//lib/prism/node.rb#5377 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, parent: T.nilable(Prism::Node), - child: T.any(Prism::ConstantReadNode, Prism::MissingNode), + name: T.nilable(Symbol), delimiter_loc: Prism::Location, - location: Prism::Location + name_loc: Prism::Location ).void end - def initialize(source, parent, child, delimiter_loc, location); end + def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5703 + # source://prism//lib/prism/node.rb#5477 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5605 + # source://prism//lib/prism/node.rb#5389 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader child: ConstantReadNode | MissingNode + # Previously, we had a child node on this class that contained either a + # constant read or a missing node. To not cause a breaking change, we + # continue to supply that API. # - # source://prism//lib/prism/node.rb#5644 - sig { returns(T.any(Prism::ConstantReadNode, Prism::MissingNode)) } + # source://prism//lib/prism/node_ext.rb#243 def child; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5610 + # source://prism//lib/prism/node.rb#5394 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5623 + # source://prism//lib/prism/node.rb#5406 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5615 + # source://prism//lib/prism/node.rb#5399 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?parent: Prism::node?, ?child: ConstantReadNode | MissingNode, ?delimiter_loc: Location, ?location: Location) -> ConstantPathTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode # - # source://prism//lib/prism/node.rb#5628 + # source://prism//lib/prism/node.rb#5411 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, parent: T.nilable(Prism::Node), - child: T.any(Prism::ConstantReadNode, Prism::MissingNode), + name: T.nilable(Symbol), delimiter_loc: Prism::Location, - location: Prism::Location + name_loc: Prism::Location ).returns(Prism::ConstantPathTargetNode) end - def copy(parent: T.unsafe(nil), child: T.unsafe(nil), delimiter_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5610 + # source://prism//lib/prism/node.rb#5394 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?, child: ConstantReadNode | MissingNode, delimiter_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location } # - # source://prism//lib/prism/node.rb#5636 + # source://prism//lib/prism/node.rb#5419 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def delimiter: () -> String # - # source://prism//lib/prism/node.rb#5654 + # source://prism//lib/prism/node.rb#5456 sig { returns(String) } def delimiter; end # attr_reader delimiter_loc: Location # - # source://prism//lib/prism/node.rb#5647 + # source://prism//lib/prism/node.rb#5430 sig { returns(Prism::Location) } def delimiter_loc; end @@ -7690,57 +7997,63 @@ class Prism::ConstantPathTargetNode < ::Prism::Node # Returns the full name of this constant path. For example: "Foo::Bar" # - # source://prism//lib/prism/node_ext.rb#190 + # source://prism//lib/prism/node_ext.rb#236 sig { returns(String) } def full_name; end # Returns the list of parts for the full name of this constant path. # For example: [:Foo, :Bar] # - # source://prism//lib/prism/node_ext.rb#170 + # source://prism//lib/prism/node_ext.rb#216 sig { returns(T::Array[Symbol]) } def full_name_parts; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#5461 + sig { override.returns(String) } + def inspect; end + + # attr_reader name: Symbol? + # + # source://prism//lib/prism/node.rb#5427 + sig { returns(T.nilable(Symbol)) } + def name; end + + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#5659 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5443 + sig { returns(Prism::Location) } + def name_loc; end # attr_reader parent: Prism::node? # - # source://prism//lib/prism/node.rb#5641 + # source://prism//lib/prism/node.rb#5424 sig { returns(T.nilable(Prism::Node)) } def parent; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the delimiter_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#5438 + def save_delimiter_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#5451 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#5687 + # source://prism//lib/prism/node.rb#5466 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#5697 + # source://prism//lib/prism/node.rb#5471 def type; end end end @@ -7756,92 +8069,96 @@ end # ::Foo::Bar = 1 # ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#5721 +# source://prism//lib/prism/node.rb#5496 class Prism::ConstantPathWriteNode < ::Prism::Node - # def initialize: (ConstantPathNode target, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new ConstantPathWriteNode node. # # @return [ConstantPathWriteNode] a new instance of ConstantPathWriteNode # - # source://prism//lib/prism/node.rb#5723 + # source://prism//lib/prism/node.rb#5498 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, target, operator_loc, value, location); end + def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5836 + # source://prism//lib/prism/node.rb#5594 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5733 + # source://prism//lib/prism/node.rb#5509 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5738 + # source://prism//lib/prism/node.rb#5514 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5748 + # source://prism//lib/prism/node.rb#5524 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5743 + # source://prism//lib/prism/node.rb#5519 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> ConstantPathWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode # - # source://prism//lib/prism/node.rb#5753 + # source://prism//lib/prism/node.rb#5529 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, target: Prism::ConstantPathNode, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::ConstantPathWriteNode) end - def copy(target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5738 + # source://prism//lib/prism/node.rb#5514 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#5761 + # source://prism//lib/prism/node.rb#5537 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5796 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5578 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#5791 + # source://prism//lib/prism/node.rb#5573 sig { returns(String) } def operator; end @@ -7850,10 +8167,16 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # ::ABC = 123 # ^ # - # source://prism//lib/prism/node.rb#5778 + # source://prism//lib/prism/node.rb#5554 sig { returns(Prism::Location) } def operator_loc; end + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#5562 + def save_operator_loc(repository); end + # A node representing the constant path being written to. # # Foo::Bar = 1 @@ -7862,26 +8185,13 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # ::Foo = :abc # ^^^^^ # - # source://prism//lib/prism/node.rb#5772 + # source://prism//lib/prism/node.rb#5548 sig { returns(Prism::ConstantPathNode) } def target; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#5820 + # source://prism//lib/prism/node.rb#5583 sig { override.returns(Symbol) } def type; end @@ -7890,19 +8200,14 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # FOO::BAR = :abc # ^^^^ # - # source://prism//lib/prism/node.rb#5788 + # source://prism//lib/prism/node.rb#5570 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5830 + # source://prism//lib/prism/node.rb#5588 def type; end end end @@ -7912,62 +8217,69 @@ end # Foo # ^^^ # -# source://prism//lib/prism/node.rb#5848 +# source://prism//lib/prism/node.rb#5606 class Prism::ConstantReadNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new ConstantReadNode node. # # @return [ConstantReadNode] a new instance of ConstantReadNode # - # source://prism//lib/prism/node.rb#5850 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#5608 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#5934 + # source://prism//lib/prism/node.rb#5673 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5858 + # source://prism//lib/prism/node.rb#5617 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5863 + # source://prism//lib/prism/node.rb#5622 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5873 + # source://prism//lib/prism/node.rb#5632 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5868 + # source://prism//lib/prism/node.rb#5627 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> ConstantReadNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantReadNode # - # source://prism//lib/prism/node.rb#5878 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::ConstantReadNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5637 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantReadNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5863 + # source://prism//lib/prism/node.rb#5622 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#5886 + # source://prism//lib/prism/node.rb#5645 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -7976,22 +8288,22 @@ class Prism::ConstantReadNode < ::Prism::Node # Returns the full name of this constant. For example: "Foo" # - # source://prism//lib/prism/node_ext.rb#107 + # source://prism//lib/prism/node_ext.rb#139 sig { returns(String) } def full_name; end # Returns the list of parts for the full name of this constant. # For example: [:Foo] # - # source://prism//lib/prism/node_ext.rb#102 + # source://prism//lib/prism/node_ext.rb#134 sig { returns(T::Array[Symbol]) } def full_name_parts; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5898 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5657 + sig { override.returns(String) } + def inspect; end # The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants). # @@ -7999,38 +8311,20 @@ class Prism::ConstantReadNode < ::Prism::Node # # SOME_CONSTANT # name `:SOME_CONSTANT` # - # source://prism//lib/prism/node.rb#5895 + # source://prism//lib/prism/node.rb#5654 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5918 + # source://prism//lib/prism/node.rb#5662 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#5928 + # source://prism//lib/prism/node.rb#5667 def type; end end end @@ -8040,62 +8334,69 @@ end # Foo, Bar = baz # ^^^ ^^^ # -# source://prism//lib/prism/node.rb#5944 +# source://prism//lib/prism/node.rb#5683 class Prism::ConstantTargetNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new ConstantTargetNode node. # # @return [ConstantTargetNode] a new instance of ConstantTargetNode # - # source://prism//lib/prism/node.rb#5946 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#5685 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6026 + # source://prism//lib/prism/node.rb#5746 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#5954 + # source://prism//lib/prism/node.rb#5694 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5959 + # source://prism//lib/prism/node.rb#5699 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#5969 + # source://prism//lib/prism/node.rb#5709 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#5964 + # source://prism//lib/prism/node.rb#5704 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> ConstantTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantTargetNode # - # source://prism//lib/prism/node.rb#5974 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::ConstantTargetNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5714 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantTargetNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#5959 + # source://prism//lib/prism/node.rb#5699 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#5982 + # source://prism//lib/prism/node.rb#5722 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -8104,57 +8405,39 @@ class Prism::ConstantTargetNode < ::Prism::Node # Returns the full name of this constant. For example: "Foo" # - # source://prism//lib/prism/node_ext.rb#203 + # source://prism//lib/prism/node_ext.rb#262 sig { returns(String) } def full_name; end # Returns the list of parts for the full name of this constant. # For example: [:Foo] # - # source://prism//lib/prism/node_ext.rb#198 + # source://prism//lib/prism/node_ext.rb#257 sig { returns(T::Array[Symbol]) } def full_name_parts; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#5990 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5730 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#5987 + # source://prism//lib/prism/node.rb#5727 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#6010 + # source://prism//lib/prism/node.rb#5735 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#6020 + # source://prism//lib/prism/node.rb#5740 def type; end end end @@ -8164,79 +8447,83 @@ end # Foo = 1 # ^^^^^^^ # -# source://prism//lib/prism/node.rb#6036 +# source://prism//lib/prism/node.rb#5756 class Prism::ConstantWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Prism::node value, Location operator_loc, Location location) -> void + # Initialize a new ConstantWriteNode node. # # @return [ConstantWriteNode] a new instance of ConstantWriteNode # - # source://prism//lib/prism/node.rb#6038 + # source://prism//lib/prism/node.rb#5758 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, name, name_loc, value, operator_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6163 + # source://prism//lib/prism/node.rb#5872 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6049 + # source://prism//lib/prism/node.rb#5770 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6054 + # source://prism//lib/prism/node.rb#5775 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6064 + # source://prism//lib/prism/node.rb#5785 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6059 + # source://prism//lib/prism/node.rb#5780 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location, ?location: Location) -> ConstantWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode # - # source://prism//lib/prism/node.rb#6069 + # source://prism//lib/prism/node.rb#5790 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::ConstantWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6054 + # source://prism//lib/prism/node.rb#5775 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#6077 + # source://prism//lib/prism/node.rb#5798 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -8245,22 +8532,22 @@ class Prism::ConstantWriteNode < ::Prism::Node # Returns the full name of this constant. For example: "Foo" # - # source://prism//lib/prism/node_ext.rb#120 + # source://prism//lib/prism/node_ext.rb#152 sig { returns(String) } def full_name; end # Returns the list of parts for the full name of this constant. # For example: [:Foo] # - # source://prism//lib/prism/node_ext.rb#115 + # source://prism//lib/prism/node_ext.rb#147 sig { returns(T::Array[Symbol]) } def full_name_parts; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#6123 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#5856 + sig { override.returns(String) } + def inspect; end # The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants). # @@ -8268,7 +8555,7 @@ class Prism::ConstantWriteNode < ::Prism::Node # # XYZ = 1 # name `:XYZ` # - # source://prism//lib/prism/node.rb#6086 + # source://prism//lib/prism/node.rb#5807 sig { returns(Symbol) } def name; end @@ -8277,13 +8564,13 @@ class Prism::ConstantWriteNode < ::Prism::Node # FOO = 1 # ^^^ # - # source://prism//lib/prism/node.rb#6092 + # source://prism//lib/prism/node.rb#5813 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#6118 + # source://prism//lib/prism/node.rb#5851 sig { returns(String) } def operator; end @@ -8292,26 +8579,25 @@ class Prism::ConstantWriteNode < ::Prism::Node # FOO = :bar # ^ # - # source://prism//lib/prism/node.rb#6111 + # source://prism//lib/prism/node.rb#5838 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#5821 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#5846 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#6147 + # source://prism//lib/prism/node.rb#5861 sig { override.returns(Symbol) } def type; end @@ -8323,19 +8609,14 @@ class Prism::ConstantWriteNode < ::Prism::Node # MyClass = Class.new # ^^^^^^^^^ # - # source://prism//lib/prism/node.rb#6105 + # source://prism//lib/prism/node.rb#5832 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#6157 + # source://prism//lib/prism/node.rb#5866 def type; end end end @@ -8343,936 +8624,2648 @@ end # The DSL module provides a set of methods that can be used to create prism # nodes in a more concise manner. For example, instead of writing: # -# source = Prism::Source.new("[1]") +# source = Prism::Source.for("[1]") # # Prism::ArrayNode.new( +# source, +# 0, +# Prism::Location.new(source, 0, 3), +# 0, # [ # Prism::IntegerNode.new( -# Prism::IntegerBaseFlags::DECIMAL, -# 1, +# source, +# 0, # Prism::Location.new(source, 1, 1), -# source +# Prism::IntegerBaseFlags::DECIMAL, +# 1 # ) # ], # Prism::Location.new(source, 0, 1), -# Prism::Location.new(source, 2, 1), -# source +# Prism::Location.new(source, 2, 1) # ) # # you could instead write: # -# source = Prism::Source.new("[1]") +# class Builder +# include Prism::DSL # -# ArrayNode( -# IntegerNode(Prism::IntegerBaseFlags::DECIMAL, 1, Location(source, 1, 1)), source), -# Location(source, 0, 1), -# Location(source, 2, 1), -# source -# ) +# attr_reader :default_source # -# This is mostly helpful in the context of writing tests, but can also be used -# to generate trees programmatically. +# def initialize +# @default_source = source("[1]") +# end +# +# def build +# array_node( +# location: location(start_offset: 0, length: 3), +# elements: [ +# integer_node( +# location: location(start_offset: 1, length: 1), +# flags: integer_base_flag(:decimal), +# value: 1 +# ) +# ], +# opening_loc: location(start_offset: 0, length: 1), +# closing_loc: location(start_offset: 2, length: 1) +# ) +# end +# end +# +# This is mostly helpful in the context of generating trees programmatically. # -# source://prism//lib/prism/dsl.rb#42 +# source://prism//lib/prism/dsl.rb#61 module Prism::DSL - private - - # Create a new AliasGlobalVariableNode node - # - # source://prism//lib/prism/dsl.rb#51 - def AliasGlobalVariableNode(new_name, old_name, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new AliasMethodNode node - # - # source://prism//lib/prism/dsl.rb#56 - def AliasMethodNode(new_name, old_name, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new AlternationPatternNode node - # - # source://prism//lib/prism/dsl.rb#61 - def AlternationPatternNode(left, right, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + extend ::Prism::DSL - # Create a new AndNode node + # Create a new AliasGlobalVariableNode node. # - # source://prism//lib/prism/dsl.rb#66 - def AndNode(left, right, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#77 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode), + old_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).returns(Prism::AliasGlobalVariableNode) + end + def alias_global_variable_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new ArgumentsNode node + # Create a new AliasMethodNode node. # - # source://prism//lib/prism/dsl.rb#71 - def ArgumentsNode(flags, arguments, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#82 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode), + old_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).returns(Prism::AliasMethodNode) + end + def alias_method_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new ArrayNode node + # Create a new AlternationPatternNode node. # - # source://prism//lib/prism/dsl.rb#76 - def ArrayNode(flags, elements, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#87 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::AlternationPatternNode) + end + def alternation_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ArrayPatternNode node + # Create a new AndNode node. # - # source://prism//lib/prism/dsl.rb#81 - def ArrayPatternNode(constant, requireds, rest, posts, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#92 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::AndNode) + end + def and_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new AssocNode node + # Create a new ArgumentsNode node. # - # source://prism//lib/prism/dsl.rb#86 - def AssocNode(key, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#97 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T::Array[Prism::Node] + ).returns(Prism::ArgumentsNode) + end + def arguments_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil)); end - # Create a new AssocSplatNode node + # Retrieve the value of one of the ArgumentsNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#91 - def AssocSplatNode(value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#832 + sig { params(name: Symbol).returns(Integer) } + def arguments_node_flag(name); end - # Create a new BackReferenceReadNode node + # Create a new ArrayNode node. # - # source://prism//lib/prism/dsl.rb#96 - def BackReferenceReadNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#102 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + elements: T::Array[Prism::Node], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::ArrayNode) + end + def array_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new BeginNode node + # Retrieve the value of one of the ArrayNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#101 - def BeginNode(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#844 + sig { params(name: Symbol).returns(Integer) } + def array_node_flag(name); end - # Create a new BlockArgumentNode node + # Create a new ArrayPatternNode node. # - # source://prism//lib/prism/dsl.rb#106 - def BlockArgumentNode(expression, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#107 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + requireds: T::Array[Prism::Node], + rest: T.nilable(Prism::Node), + posts: T::Array[Prism::Node], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::ArrayPatternNode) + end + def array_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new BlockLocalVariableNode node + # Create a new AssocNode node. # - # source://prism//lib/prism/dsl.rb#111 - def BlockLocalVariableNode(flags, name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#112 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + key: Prism::Node, + value: Prism::Node, + operator_loc: T.nilable(Prism::Location) + ).returns(Prism::AssocNode) + end + def assoc_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new BlockNode node + # Create a new AssocSplatNode node. # - # source://prism//lib/prism/dsl.rb#116 - def BlockNode(locals, parameters, body, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#117 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::AssocSplatNode) + end + def assoc_splat_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new BlockParameterNode node + # Create a new BackReferenceReadNode node. # - # source://prism//lib/prism/dsl.rb#121 - def BlockParameterNode(flags, name, name_loc, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#122 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::BackReferenceReadNode) + end + def back_reference_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new BlockParametersNode node + # Create a new BeginNode node. # - # source://prism//lib/prism/dsl.rb#126 - def BlockParametersNode(parameters, locals, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#127 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + begin_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + rescue_clause: T.nilable(Prism::RescueNode), + else_clause: T.nilable(Prism::ElseNode), + ensure_clause: T.nilable(Prism::EnsureNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::BeginNode) + end + def begin_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new BreakNode node + # Create a new BlockArgumentNode node. # - # source://prism//lib/prism/dsl.rb#131 - def BreakNode(arguments, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new CallAndWriteNode node - # - # source://prism//lib/prism/dsl.rb#136 - def CallAndWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new CallNode node - # - # source://prism//lib/prism/dsl.rb#141 - def CallNode(flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#132 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::BlockArgumentNode) + end + def block_argument_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new CallOperatorWriteNode node + # Create a new BlockLocalVariableNode node. # - # source://prism//lib/prism/dsl.rb#146 - def CallOperatorWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#137 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::BlockLocalVariableNode) + end + def block_local_variable_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new CallOrWriteNode node + # Create a new BlockNode node. # - # source://prism//lib/prism/dsl.rb#151 - def CallOrWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#142 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::BlockNode) + end + def block_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new CallTargetNode node + # Create a new BlockParameterNode node. # - # source://prism//lib/prism/dsl.rb#156 - def CallTargetNode(flags, receiver, call_operator_loc, name, message_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#147 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location + ).returns(Prism::BlockParameterNode) + end + def block_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new CapturePatternNode node + # Create a new BlockParametersNode node. # - # source://prism//lib/prism/dsl.rb#161 - def CapturePatternNode(value, target, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#152 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parameters: T.nilable(Prism::ParametersNode), + locals: T::Array[Prism::BlockLocalVariableNode], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::BlockParametersNode) + end + def block_parameters_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new CaseMatchNode node + # Create a new BreakNode node. # - # source://prism//lib/prism/dsl.rb#166 - def CaseMatchNode(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#157 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).returns(Prism::BreakNode) + end + def break_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new CaseNode node + # Create a new CallAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#171 - def CaseNode(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#162 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + message_loc: T.nilable(Prism::Location), + read_name: Symbol, + write_name: Symbol, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::CallAndWriteNode) + end + def call_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ClassNode node + # Create a new CallNode node. # - # source://prism//lib/prism/dsl.rb#176 - def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#167 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + name: Symbol, + message_loc: T.nilable(Prism::Location), + opening_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + closing_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).returns(Prism::CallNode) + end + def call_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end - # Create a new ClassVariableAndWriteNode node + # Retrieve the value of one of the CallNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#181 - def ClassVariableAndWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#852 + sig { params(name: Symbol).returns(Integer) } + def call_node_flag(name); end - # Create a new ClassVariableOperatorWriteNode node + # Create a new CallOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#186 - def ClassVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#172 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + message_loc: T.nilable(Prism::Location), + read_name: Symbol, + write_name: Symbol, + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::CallOperatorWriteNode) + end + def call_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ClassVariableOrWriteNode node + # Create a new CallOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#191 - def ClassVariableOrWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#177 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + message_loc: T.nilable(Prism::Location), + read_name: Symbol, + write_name: Symbol, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::CallOrWriteNode) + end + def call_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ClassVariableReadNode node + # Create a new CallTargetNode node. # - # source://prism//lib/prism/dsl.rb#196 - def ClassVariableReadNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#182 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: Prism::Node, + call_operator_loc: Prism::Location, + name: Symbol, + message_loc: Prism::Location + ).returns(Prism::CallTargetNode) + end + def call_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil)); end - # Create a new ClassVariableTargetNode node + # Create a new CapturePatternNode node. # - # source://prism//lib/prism/dsl.rb#201 - def ClassVariableTargetNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#187 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + target: Prism::LocalVariableTargetNode, + operator_loc: Prism::Location + ).returns(Prism::CapturePatternNode) + end + def capture_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ClassVariableWriteNode node + # Create a new CaseMatchNode node. # - # source://prism//lib/prism/dsl.rb#206 - def ClassVariableWriteNode(name, name_loc, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#192 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::InNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).returns(Prism::CaseMatchNode) + end + def case_match_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new ConstantAndWriteNode node + # Create a new CaseNode node. # - # source://prism//lib/prism/dsl.rb#211 - def ConstantAndWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#197 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::WhenNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).returns(Prism::CaseNode) + end + def case_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new ConstantOperatorWriteNode node + # Create a new ClassNode node. # - # source://prism//lib/prism/dsl.rb#216 - def ConstantOperatorWriteNode(name, name_loc, operator_loc, value, operator, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#202 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode), + inheritance_operator_loc: T.nilable(Prism::Location), + superclass: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).returns(Prism::ClassNode) + end + def class_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new ConstantOrWriteNode node + # Create a new ClassVariableAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#221 - def ConstantOrWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#207 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ClassVariableAndWriteNode) + end + def class_variable_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ConstantPathAndWriteNode node + # Create a new ClassVariableOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#226 - def ConstantPathAndWriteNode(target, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#212 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ClassVariableOperatorWriteNode) + end + def class_variable_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end - # Create a new ConstantPathNode node + # Create a new ClassVariableOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#231 - def ConstantPathNode(parent, child, delimiter_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#217 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ClassVariableOrWriteNode) + end + def class_variable_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ConstantPathOperatorWriteNode node + # Create a new ClassVariableReadNode node. # - # source://prism//lib/prism/dsl.rb#236 - def ConstantPathOperatorWriteNode(target, operator_loc, value, operator, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#222 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableReadNode) + end + def class_variable_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new ConstantPathOrWriteNode node + # Create a new ClassVariableTargetNode node. # - # source://prism//lib/prism/dsl.rb#241 - def ConstantPathOrWriteNode(target, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#227 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableTargetNode) + end + def class_variable_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new ConstantPathTargetNode node + # Create a new ClassVariableWriteNode node. # - # source://prism//lib/prism/dsl.rb#246 - def ConstantPathTargetNode(parent, child, delimiter_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#232 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::ClassVariableWriteNode) + end + def class_variable_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ConstantPathWriteNode node + # Create a new ConstantAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#251 - def ConstantPathWriteNode(target, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#237 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantAndWriteNode) + end + def constant_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ConstantReadNode node + # Create a new ConstantOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#256 - def ConstantReadNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#242 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ConstantOperatorWriteNode) + end + def constant_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end - # Create a new ConstantTargetNode node + # Create a new ConstantOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#261 - def ConstantTargetNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#247 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantOrWriteNode) + end + def constant_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ConstantWriteNode node + # Create a new ConstantPathAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#266 - def ConstantWriteNode(name, name_loc, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#252 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathAndWriteNode) + end + def constant_path_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new DefNode node + # Create a new ConstantPathNode node. # - # source://prism//lib/prism/dsl.rb#271 - def DefNode(name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#257 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).returns(Prism::ConstantPathNode) + end + def constant_path_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end - # Create a new DefinedNode node + # Create a new ConstantPathOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#276 - def DefinedNode(lparen_loc, value, rparen_loc, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#262 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ConstantPathOperatorWriteNode) + end + def constant_path_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end - # Create a new ElseNode node + # Create a new ConstantPathOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#281 - def ElseNode(else_keyword_loc, statements, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#267 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathOrWriteNode) + end + def constant_path_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new EmbeddedStatementsNode node + # Create a new ConstantPathTargetNode node. # - # source://prism//lib/prism/dsl.rb#286 - def EmbeddedStatementsNode(opening_loc, statements, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#272 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).returns(Prism::ConstantPathTargetNode) + end + def constant_path_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end - # Create a new EmbeddedVariableNode node + # Create a new ConstantPathWriteNode node. # - # source://prism//lib/prism/dsl.rb#291 - def EmbeddedVariableNode(operator_loc, variable, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new EnsureNode node - # - # source://prism//lib/prism/dsl.rb#296 - def EnsureNode(ensure_keyword_loc, statements, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new FalseNode node - # - # source://prism//lib/prism/dsl.rb#301 - def FalseNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#277 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathWriteNode) + end + def constant_path_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new FindPatternNode node + # Create a new ConstantReadNode node. # - # source://prism//lib/prism/dsl.rb#306 - def FindPatternNode(constant, left, requireds, right, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#282 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantReadNode) + end + def constant_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new FlipFlopNode node + # Create a new ConstantTargetNode node. # - # source://prism//lib/prism/dsl.rb#311 - def FlipFlopNode(flags, left, right, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#287 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantTargetNode) + end + def constant_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new FloatNode node + # Create a new ConstantWriteNode node. # - # source://prism//lib/prism/dsl.rb#316 - def FloatNode(value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#292 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::ConstantWriteNode) + end + def constant_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ForNode node + # Create a new DefNode node. # - # source://prism//lib/prism/dsl.rb#321 - def ForNode(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#297 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + receiver: T.nilable(Prism::Node), + parameters: T.nilable(Prism::ParametersNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + locals: T::Array[Symbol], + def_keyword_loc: Prism::Location, + operator_loc: T.nilable(Prism::Location), + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + equal_loc: T.nilable(Prism::Location), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::DefNode) + end + def def_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new ForwardingArgumentsNode node + # Create a new DefinedNode node. # - # source://prism//lib/prism/dsl.rb#326 - def ForwardingArgumentsNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#302 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lparen_loc: T.nilable(Prism::Location), + value: Prism::Node, + rparen_loc: T.nilable(Prism::Location), + keyword_loc: Prism::Location + ).returns(Prism::DefinedNode) + end + def defined_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new ForwardingParameterNode node + # Create a new ElseNode node. # - # source://prism//lib/prism/dsl.rb#331 - def ForwardingParameterNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#307 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + else_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::ElseNode) + end + def else_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new ForwardingSuperNode node + # Create a new EmbeddedStatementsNode node. # - # source://prism//lib/prism/dsl.rb#336 - def ForwardingSuperNode(block, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#312 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + closing_loc: Prism::Location + ).returns(Prism::EmbeddedStatementsNode) + end + def embedded_statements_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new GlobalVariableAndWriteNode node + # Create a new EmbeddedVariableNode node. # - # source://prism//lib/prism/dsl.rb#341 - def GlobalVariableAndWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#317 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + variable: T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode) + ).returns(Prism::EmbeddedVariableNode) + end + def embedded_variable_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), variable: T.unsafe(nil)); end - # Create a new GlobalVariableOperatorWriteNode node + # Retrieve the value of one of the EncodingFlags flags. # - # source://prism//lib/prism/dsl.rb#346 - def GlobalVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#863 + sig { params(name: Symbol).returns(Integer) } + def encoding_flag(name); end - # Create a new GlobalVariableOrWriteNode node + # Create a new EnsureNode node. # - # source://prism//lib/prism/dsl.rb#351 - def GlobalVariableOrWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#322 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + ensure_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: Prism::Location + ).returns(Prism::EnsureNode) + end + def ensure_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new GlobalVariableReadNode node + # Create a new FalseNode node. # - # source://prism//lib/prism/dsl.rb#356 - def GlobalVariableReadNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#327 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::FalseNode) + end + def false_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new GlobalVariableTargetNode node + # Create a new FindPatternNode node. # - # source://prism//lib/prism/dsl.rb#361 - def GlobalVariableTargetNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#332 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + left: Prism::SplatNode, + requireds: T::Array[Prism::Node], + right: T.any(Prism::SplatNode, Prism::MissingNode), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::FindPatternNode) + end + def find_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new GlobalVariableWriteNode node + # Create a new FlipFlopNode node. # - # source://prism//lib/prism/dsl.rb#366 - def GlobalVariableWriteNode(name, name_loc, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#337 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: T.nilable(Prism::Node), + right: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::FlipFlopNode) + end + def flip_flop_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new HashNode node + # Create a new FloatNode node. # - # source://prism//lib/prism/dsl.rb#371 - def HashNode(opening_loc, elements, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#342 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Float + ).returns(Prism::FloatNode) + end + def float_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new HashPatternNode node + # Create a new ForNode node. # - # source://prism//lib/prism/dsl.rb#376 - def HashPatternNode(constant, elements, rest, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#347 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + index: T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode), + collection: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + for_keyword_loc: Prism::Location, + in_keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), + end_keyword_loc: Prism::Location + ).returns(Prism::ForNode) + end + def for_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new IfNode node + # Create a new ForwardingArgumentsNode node. # - # source://prism//lib/prism/dsl.rb#381 - def IfNode(if_keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#352 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::ForwardingArgumentsNode) + end + def forwarding_arguments_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new ImaginaryNode node + # Create a new ForwardingParameterNode node. # - # source://prism//lib/prism/dsl.rb#386 - def ImaginaryNode(numeric, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#357 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::ForwardingParameterNode) + end + def forwarding_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new ImplicitNode node + # Create a new ForwardingSuperNode node. # - # source://prism//lib/prism/dsl.rb#391 - def ImplicitNode(value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#362 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + block: T.nilable(Prism::BlockNode) + ).returns(Prism::ForwardingSuperNode) + end + def forwarding_super_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), block: T.unsafe(nil)); end - # Create a new ImplicitRestNode node + # Create a new GlobalVariableAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#396 - def ImplicitRestNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#367 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::GlobalVariableAndWriteNode) + end + def global_variable_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new InNode node + # Create a new GlobalVariableOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#401 - def InNode(pattern, statements, in_loc, then_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#372 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::GlobalVariableOperatorWriteNode) + end + def global_variable_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end - # Create a new IndexAndWriteNode node + # Create a new GlobalVariableOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#406 - def IndexAndWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#377 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::GlobalVariableOrWriteNode) + end + def global_variable_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new IndexOperatorWriteNode node + # Create a new GlobalVariableReadNode node. # - # source://prism//lib/prism/dsl.rb#411 - def IndexOperatorWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#382 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableReadNode) + end + def global_variable_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new IndexOrWriteNode node + # Create a new GlobalVariableTargetNode node. # - # source://prism//lib/prism/dsl.rb#416 - def IndexOrWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#387 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableTargetNode) + end + def global_variable_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new IndexTargetNode node + # Create a new GlobalVariableWriteNode node. # - # source://prism//lib/prism/dsl.rb#421 - def IndexTargetNode(flags, receiver, opening_loc, arguments, closing_loc, block, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#392 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::GlobalVariableWriteNode) + end + def global_variable_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new InstanceVariableAndWriteNode node + # Create a new HashNode node. # - # source://prism//lib/prism/dsl.rb#426 - def InstanceVariableAndWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#397 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], + closing_loc: Prism::Location + ).returns(Prism::HashNode) + end + def hash_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new InstanceVariableOperatorWriteNode node + # Create a new HashPatternNode node. # - # source://prism//lib/prism/dsl.rb#431 - def InstanceVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#402 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + elements: T::Array[Prism::AssocNode], + rest: T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode)), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::HashPatternNode) + end + def hash_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new InstanceVariableOrWriteNode node + # Create a new IfNode node. # - # source://prism//lib/prism/dsl.rb#436 - def InstanceVariableOrWriteNode(name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#407 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + if_keyword_loc: T.nilable(Prism::Location), + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(T.any(Prism::ElseNode, Prism::IfNode)), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::IfNode) + end + def if_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Create a new InstanceVariableReadNode node + # Create a new ImaginaryNode node. # - # source://prism//lib/prism/dsl.rb#441 - def InstanceVariableReadNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#412 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode) + ).returns(Prism::ImaginaryNode) + end + def imaginary_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numeric: T.unsafe(nil)); end - # Create a new InstanceVariableTargetNode node + # Create a new ImplicitNode node. # - # source://prism//lib/prism/dsl.rb#446 - def InstanceVariableTargetNode(name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#417 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode) + ).returns(Prism::ImplicitNode) + end + def implicit_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new InstanceVariableWriteNode node + # Create a new ImplicitRestNode node. # - # source://prism//lib/prism/dsl.rb#451 - def InstanceVariableWriteNode(name, name_loc, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#422 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::ImplicitRestNode) + end + def implicit_rest_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new IntegerNode node + # Create a new InNode node. # - # source://prism//lib/prism/dsl.rb#456 - def IntegerNode(flags, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#427 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + pattern: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + in_loc: Prism::Location, + then_loc: T.nilable(Prism::Location) + ).returns(Prism::InNode) + end + def in_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil)); end - # Create a new InterpolatedMatchLastLineNode node + # Create a new IndexAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#461 - def InterpolatedMatchLastLineNode(flags, opening_loc, parts, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#432 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + opening_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode), + closing_loc: Prism::Location, + block: T.nilable(Prism::BlockArgumentNode), + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::IndexAndWriteNode) + end + def index_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new InterpolatedRegularExpressionNode node + # Create a new IndexOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#466 - def InterpolatedRegularExpressionNode(flags, opening_loc, parts, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#437 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + opening_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode), + closing_loc: Prism::Location, + block: T.nilable(Prism::BlockArgumentNode), + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::IndexOperatorWriteNode) + end + def index_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new InterpolatedStringNode node + # Create a new IndexOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#471 - def InterpolatedStringNode(flags, opening_loc, parts, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new InterpolatedSymbolNode node - # - # source://prism//lib/prism/dsl.rb#476 - def InterpolatedSymbolNode(opening_loc, parts, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new InterpolatedXStringNode node - # - # source://prism//lib/prism/dsl.rb#481 - def InterpolatedXStringNode(opening_loc, parts, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new ItParametersNode node - # - # source://prism//lib/prism/dsl.rb#486 - def ItParametersNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#442 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: T.nilable(Prism::Node), + call_operator_loc: T.nilable(Prism::Location), + opening_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode), + closing_loc: Prism::Location, + block: T.nilable(Prism::BlockArgumentNode), + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::IndexOrWriteNode) + end + def index_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new KeywordHashNode node + # Create a new IndexTargetNode node. # - # source://prism//lib/prism/dsl.rb#491 - def KeywordHashNode(flags, elements, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#447 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + receiver: Prism::Node, + opening_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode), + closing_loc: Prism::Location, + block: T.nilable(Prism::BlockArgumentNode) + ).returns(Prism::IndexTargetNode) + end + def index_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end - # Create a new KeywordRestParameterNode node + # Create a new InstanceVariableAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#496 - def KeywordRestParameterNode(flags, name, name_loc, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#452 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableAndWriteNode) + end + def instance_variable_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new LambdaNode node + # Create a new InstanceVariableOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#501 - def LambdaNode(locals, operator_loc, opening_loc, closing_loc, parameters, body, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#457 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::InstanceVariableOperatorWriteNode) + end + def instance_variable_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end - # Create a new LocalVariableAndWriteNode node + # Create a new InstanceVariableOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#506 - def LocalVariableAndWriteNode(name_loc, operator_loc, value, name, depth, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#462 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableOrWriteNode) + end + def instance_variable_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new LocalVariableOperatorWriteNode node + # Create a new InstanceVariableReadNode node. # - # source://prism//lib/prism/dsl.rb#511 - def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, name, operator, depth, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#467 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableReadNode) + end + def instance_variable_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new LocalVariableOrWriteNode node + # Create a new InstanceVariableTargetNode node. # - # source://prism//lib/prism/dsl.rb#516 - def LocalVariableOrWriteNode(name_loc, operator_loc, value, name, depth, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#472 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableTargetNode) + end + def instance_variable_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new LocalVariableReadNode node + # Create a new InstanceVariableWriteNode node. # - # source://prism//lib/prism/dsl.rb#521 - def LocalVariableReadNode(name, depth, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#477 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::InstanceVariableWriteNode) + end + def instance_variable_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new LocalVariableTargetNode node + # Retrieve the value of one of the IntegerBaseFlags flags. # - # source://prism//lib/prism/dsl.rb#526 - def LocalVariableTargetNode(name, depth, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#872 + sig { params(name: Symbol).returns(Integer) } + def integer_base_flag(name); end - # Create a new LocalVariableWriteNode node + # Create a new IntegerNode node. # - # source://prism//lib/prism/dsl.rb#531 - def LocalVariableWriteNode(name, depth, name_loc, value, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#482 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Integer + ).returns(Prism::IntegerNode) + end + def integer_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new Location object + # Create a new InterpolatedMatchLastLineNode node. # - # source://prism//lib/prism/dsl.rb#46 - def Location(source = T.unsafe(nil), start_offset = T.unsafe(nil), length = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#487 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedMatchLastLineNode) + end + def interpolated_match_last_line_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new MatchLastLineNode node + # Create a new InterpolatedRegularExpressionNode node. # - # source://prism//lib/prism/dsl.rb#536 - def MatchLastLineNode(flags, opening_loc, content_loc, closing_loc, unescaped, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#492 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedRegularExpressionNode) + end + def interpolated_regular_expression_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new MatchPredicateNode node + # Create a new InterpolatedStringNode node. # - # source://prism//lib/prism/dsl.rb#541 - def MatchPredicateNode(value, pattern, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#497 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode, Prism::XStringNode)], + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::InterpolatedStringNode) + end + def interpolated_string_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new MatchRequiredNode node + # Retrieve the value of one of the InterpolatedStringNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#546 - def MatchRequiredNode(value, pattern, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#883 + sig { params(name: Symbol).returns(Integer) } + def interpolated_string_node_flag(name); end - # Create a new MatchWriteNode node + # Create a new InterpolatedSymbolNode node. # - # source://prism//lib/prism/dsl.rb#551 - def MatchWriteNode(call, targets, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#502 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::InterpolatedSymbolNode) + end + def interpolated_symbol_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new MissingNode node + # Create a new InterpolatedXStringNode node. # - # source://prism//lib/prism/dsl.rb#556 - def MissingNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#507 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedXStringNode) + end + def interpolated_x_string_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new ModuleNode node + # Create a new ItLocalVariableReadNode node. # - # source://prism//lib/prism/dsl.rb#561 - def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#512 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::ItLocalVariableReadNode) + end + def it_local_variable_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new MultiTargetNode node + # Create a new ItParametersNode node. # - # source://prism//lib/prism/dsl.rb#566 - def MultiTargetNode(lefts, rest, rights, lparen_loc, rparen_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#517 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::ItParametersNode) + end + def it_parameters_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new MultiWriteNode node + # Create a new KeywordHashNode node. # - # source://prism//lib/prism/dsl.rb#571 - def MultiWriteNode(lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#522 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)] + ).returns(Prism::KeywordHashNode) + end + def keyword_hash_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil)); end - # Create a new NextNode node + # Retrieve the value of one of the KeywordHashNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#576 - def NextNode(arguments, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#892 + sig { params(name: Symbol).returns(Integer) } + def keyword_hash_node_flag(name); end - # Create a new NilNode node + # Create a new KeywordRestParameterNode node. # - # source://prism//lib/prism/dsl.rb#581 - def NilNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#527 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location + ).returns(Prism::KeywordRestParameterNode) + end + def keyword_rest_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new NoKeywordsParameterNode node + # Create a new LambdaNode node. # - # source://prism//lib/prism/dsl.rb#586 - def NoKeywordsParameterNode(operator_loc, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#532 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + operator_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location, + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)) + ).returns(Prism::LambdaNode) + end + def lambda_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil)); end - # Create a new NumberedParametersNode node + # Create a new LocalVariableAndWriteNode node. # - # source://prism//lib/prism/dsl.rb#591 - def NumberedParametersNode(maximum, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#537 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableAndWriteNode) + end + def local_variable_and_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end - # Create a new NumberedReferenceReadNode node + # Create a new LocalVariableOperatorWriteNode node. # - # source://prism//lib/prism/dsl.rb#596 - def NumberedReferenceReadNode(number, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#542 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + binary_operator: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOperatorWriteNode) + end + def local_variable_operator_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), binary_operator: T.unsafe(nil), depth: T.unsafe(nil)); end - # Create a new OptionalKeywordParameterNode node + # Create a new LocalVariableOrWriteNode node. # - # source://prism//lib/prism/dsl.rb#601 - def OptionalKeywordParameterNode(flags, name, name_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#547 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOrWriteNode) + end + def local_variable_or_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end - # Create a new OptionalParameterNode node + # Create a new LocalVariableReadNode node. # - # source://prism//lib/prism/dsl.rb#606 - def OptionalParameterNode(flags, name, name_loc, operator_loc, value, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#552 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableReadNode) + end + def local_variable_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end - # Create a new OrNode node + # Create a new LocalVariableTargetNode node. # - # source://prism//lib/prism/dsl.rb#611 - def OrNode(left, right, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#557 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableTargetNode) + end + def local_variable_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end - # Create a new ParametersNode node + # Create a new LocalVariableWriteNode node. # - # source://prism//lib/prism/dsl.rb#616 - def ParametersNode(requireds, optionals, rest, posts, keywords, keyword_rest, block, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#562 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::LocalVariableWriteNode) + end + def local_variable_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ParenthesesNode node + # Create a new Location object. # - # source://prism//lib/prism/dsl.rb#621 - def ParenthesesNode(body, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#72 + sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) } + def location(source: T.unsafe(nil), start_offset: T.unsafe(nil), length: T.unsafe(nil)); end - # Create a new PinnedExpressionNode node + # Retrieve the value of one of the LoopFlags flags. # - # source://prism//lib/prism/dsl.rb#626 - def PinnedExpressionNode(expression, operator_loc, lparen_loc, rparen_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#900 + sig { params(name: Symbol).returns(Integer) } + def loop_flag(name); end - # Create a new PinnedVariableNode node + # Create a new MatchLastLineNode node. # - # source://prism//lib/prism/dsl.rb#631 - def PinnedVariableNode(variable, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#567 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).returns(Prism::MatchLastLineNode) + end + def match_last_line_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end - # Create a new PostExecutionNode node + # Create a new MatchPredicateNode node. # - # source://prism//lib/prism/dsl.rb#636 - def PostExecutionNode(statements, keyword_loc, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#572 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchPredicateNode) + end + def match_predicate_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new PreExecutionNode node + # Create a new MatchRequiredNode node. # - # source://prism//lib/prism/dsl.rb#641 - def PreExecutionNode(statements, keyword_loc, opening_loc, closing_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#577 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchRequiredNode) + end + def match_required_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new ProgramNode node + # Create a new MatchWriteNode node. # - # source://prism//lib/prism/dsl.rb#646 - def ProgramNode(locals, statements, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#582 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + call: Prism::CallNode, + targets: T::Array[Prism::LocalVariableTargetNode] + ).returns(Prism::MatchWriteNode) + end + def match_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), call: T.unsafe(nil), targets: T.unsafe(nil)); end - # Create a new RangeNode node + # Create a new MissingNode node. # - # source://prism//lib/prism/dsl.rb#651 - def RangeNode(flags, left, right, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#587 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::MissingNode) + end + def missing_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new RationalNode node + # Create a new ModuleNode node. # - # source://prism//lib/prism/dsl.rb#656 - def RationalNode(numeric, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#592 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + module_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).returns(Prism::ModuleNode) + end + def module_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end - # Create a new RedoNode node + # Create a new MultiTargetNode node. # - # source://prism//lib/prism/dsl.rb#661 - def RedoNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#597 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location) + ).returns(Prism::MultiTargetNode) + end + def multi_target_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end - # Create a new RegularExpressionNode node + # Create a new MultiWriteNode node. # - # source://prism//lib/prism/dsl.rb#666 - def RegularExpressionNode(flags, opening_loc, content_loc, closing_loc, unescaped, source = T.unsafe(nil), location = T.unsafe(nil)); end - - # Create a new RequiredKeywordParameterNode node - # - # source://prism//lib/prism/dsl.rb#671 - def RequiredKeywordParameterNode(flags, name, name_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#602 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::MultiWriteNode) + end + def multi_write_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new RequiredParameterNode node + # Create a new NextNode node. # - # source://prism//lib/prism/dsl.rb#676 - def RequiredParameterNode(flags, name, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#607 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).returns(Prism::NextNode) + end + def next_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new RescueModifierNode node + # Create a new NilNode node. # - # source://prism//lib/prism/dsl.rb#681 - def RescueModifierNode(expression, keyword_loc, rescue_expression, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#612 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::NilNode) + end + def nil_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new RescueNode node + # Create a new NoKeywordsParameterNode node. # - # source://prism//lib/prism/dsl.rb#686 - def RescueNode(keyword_loc, exceptions, operator_loc, reference, statements, consequent, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#617 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + keyword_loc: Prism::Location + ).returns(Prism::NoKeywordsParameterNode) + end + def no_keywords_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # Create a new RestParameterNode node + # Create a new NumberedParametersNode node. # - # source://prism//lib/prism/dsl.rb#691 - def RestParameterNode(flags, name, name_loc, operator_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#622 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + maximum: Integer + ).returns(Prism::NumberedParametersNode) + end + def numbered_parameters_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), maximum: T.unsafe(nil)); end - # Create a new RetryNode node + # Create a new NumberedReferenceReadNode node. # - # source://prism//lib/prism/dsl.rb#696 - def RetryNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#627 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + number: Integer + ).returns(Prism::NumberedReferenceReadNode) + end + def numbered_reference_read_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), number: T.unsafe(nil)); end - # Create a new ReturnNode node + # Create a new OptionalKeywordParameterNode node. # - # source://prism//lib/prism/dsl.rb#701 - def ReturnNode(keyword_loc, arguments, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#632 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::OptionalKeywordParameterNode) + end + def optional_keyword_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new SelfNode node + # Create a new OptionalParameterNode node. # - # source://prism//lib/prism/dsl.rb#706 - def SelfNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#637 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::OptionalParameterNode) + end + def optional_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Create a new ShareableConstantNode node + # Create a new OrNode node. # - # source://prism//lib/prism/dsl.rb#711 - def ShareableConstantNode(flags, write, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#642 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::OrNode) + end + def or_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new SingletonClassNode node + # Retrieve the value of one of the ParameterFlags flags. # - # source://prism//lib/prism/dsl.rb#716 - def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#908 + sig { params(name: Symbol).returns(Integer) } + def parameter_flag(name); end - # Create a new SourceEncodingNode node + # Create a new ParametersNode node. # - # source://prism//lib/prism/dsl.rb#721 - def SourceEncodingNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#647 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], + optionals: T::Array[Prism::OptionalParameterNode], + rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), + posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)], + keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], + keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), + block: T.nilable(Prism::BlockParameterNode) + ).returns(Prism::ParametersNode) + end + def parameters_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil)); end - # Create a new SourceFileNode node + # Create a new ParenthesesNode node. # - # source://prism//lib/prism/dsl.rb#726 - def SourceFileNode(flags, filepath, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#652 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T.nilable(Prism::Node), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::ParenthesesNode) + end + def parentheses_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new SourceLineNode node + # Retrieve the value of one of the ParenthesesNodeFlags flags. # - # source://prism//lib/prism/dsl.rb#731 - def SourceLineNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#916 + sig { params(name: Symbol).returns(Integer) } + def parentheses_node_flag(name); end - # Create a new SplatNode node + # Create a new PinnedExpressionNode node. # - # source://prism//lib/prism/dsl.rb#736 - def SplatNode(operator_loc, expression, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#657 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + operator_loc: Prism::Location, + lparen_loc: Prism::Location, + rparen_loc: Prism::Location + ).returns(Prism::PinnedExpressionNode) + end + def pinned_expression_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end - # Create a new StatementsNode node + # Create a new PinnedVariableNode node. # - # source://prism//lib/prism/dsl.rb#741 - def StatementsNode(body, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#662 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + variable: T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode), + operator_loc: Prism::Location + ).returns(Prism::PinnedVariableNode) + end + def pinned_variable_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), variable: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new StringNode node + # Create a new PostExecutionNode node. # - # source://prism//lib/prism/dsl.rb#746 - def StringNode(flags, opening_loc, content_loc, closing_loc, unescaped, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#667 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PostExecutionNode) + end + def post_execution_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new SuperNode node + # Create a new PreExecutionNode node. # - # source://prism//lib/prism/dsl.rb#751 - def SuperNode(keyword_loc, lparen_loc, arguments, rparen_loc, block, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#672 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PreExecutionNode) + end + def pre_execution_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # Create a new SymbolNode node + # Create a new ProgramNode node. # - # source://prism//lib/prism/dsl.rb#756 - def SymbolNode(flags, opening_loc, value_loc, closing_loc, unescaped, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#677 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + statements: Prism::StatementsNode + ).returns(Prism::ProgramNode) + end + def program_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), statements: T.unsafe(nil)); end - # Create a new TrueNode node + # Retrieve the value of one of the RangeFlags flags. # - # source://prism//lib/prism/dsl.rb#761 - def TrueNode(source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#924 + sig { params(name: Symbol).returns(Integer) } + def range_flag(name); end - # Create a new UndefNode node + # Create a new RangeNode node. # - # source://prism//lib/prism/dsl.rb#766 - def UndefNode(names, keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#682 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: T.nilable(Prism::Node), + right: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::RangeNode) + end + def range_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Create a new UnlessNode node + # Create a new RationalNode node. # - # source://prism//lib/prism/dsl.rb#771 - def UnlessNode(keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#687 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + numerator: Integer, + denominator: Integer + ).returns(Prism::RationalNode) + end + def rational_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numerator: T.unsafe(nil), denominator: T.unsafe(nil)); end - # Create a new UntilNode node + # Create a new RedoNode node. # - # source://prism//lib/prism/dsl.rb#776 - def UntilNode(flags, keyword_loc, closing_loc, predicate, statements, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#692 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::RedoNode) + end + def redo_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Create a new WhenNode node + # Retrieve the value of one of the RegularExpressionFlags flags. # - # source://prism//lib/prism/dsl.rb#781 - def WhenNode(keyword_loc, conditions, then_keyword_loc, statements, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#932 + sig { params(name: Symbol).returns(Integer) } + def regular_expression_flag(name); end - # Create a new WhileNode node + # Create a new RegularExpressionNode node. # - # source://prism//lib/prism/dsl.rb#786 - def WhileNode(flags, keyword_loc, closing_loc, predicate, statements, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#697 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).returns(Prism::RegularExpressionNode) + end + def regular_expression_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end - # Create a new XStringNode node + # Create a new RequiredKeywordParameterNode node. # - # source://prism//lib/prism/dsl.rb#791 - def XStringNode(flags, opening_loc, content_loc, closing_loc, unescaped, source = T.unsafe(nil), location = T.unsafe(nil)); end + # source://prism//lib/prism/dsl.rb#702 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location + ).returns(Prism::RequiredKeywordParameterNode) + end + def required_keyword_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil)); end - # Create a new YieldNode node + # Create a new RequiredParameterNode node. # - # source://prism//lib/prism/dsl.rb#796 - def YieldNode(keyword_loc, lparen_loc, arguments, rparen_loc, source = T.unsafe(nil), location = T.unsafe(nil)); end -end - -# This module is used for testing and debugging and is not meant to be used by -# consumers of this library. -# -# source://prism//lib/prism/debug.rb#6 -module Prism::Debug - class << self - # :call-seq: - # Debug::cruby_locals(source) -> Array - # - # For the given source, compiles with CRuby and returns a list of all of the - # sets of local variables that were encountered. - # - # source://prism//lib/prism/debug.rb#54 - def cruby_locals(source); end - - def format_errors(_arg0, _arg1); end - def inspect_node(_arg0); end - def integer_parse(_arg0); end - def memsize(_arg0); end - def named_captures(_arg0); end - - # :call-seq: - # Debug::newlines(source) -> Array - # - # For the given source string, return the byte offsets of every newline in - # the source. - # - # source://prism//lib/prism/debug.rb#202 - def newlines(source); end - - # :call-seq: - # Debug::prism_locals(source) -> Array - # - # For the given source, parses with prism and returns a list of all of the - # sets of local variables that were encountered. - # - # source://prism//lib/prism/debug.rb#98 - def prism_locals(source); end - - def profile_file(_arg0); end - def static_inspect(*_arg0); end + # source://prism//lib/prism/dsl.rb#707 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::RequiredParameterNode) end -end - -# Used to hold the place of a local that will be in the local table but -# cannot be accessed directly from the source code. For example, the -# iteration variable in a for loop or the positional parameter on a method -# definition that is destructured. -# -# source://prism//lib/prism/debug.rb#90 -Prism::Debug::AnonymousLocal = T.let(T.unsafe(nil), Object) + def required_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end -# A wrapping around prism's internal encoding data structures. This is used -# for reflection and debugging purposes. -# -# source://prism//lib/prism/debug.rb#208 -class Prism::Debug::Encoding - # Initialize a new encoding with the given name and whether or not it is - # a multibyte encoding. + # Create a new RescueModifierNode node. # - # @return [Encoding] a new instance of Encoding - # - # source://prism//lib/prism/debug.rb#214 - def initialize(name, multibyte); end + # source://prism//lib/prism/dsl.rb#712 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + keyword_loc: Prism::Location, + rescue_expression: Prism::Node + ).returns(Prism::RescueModifierNode) + end + def rescue_modifier_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil)); end - # Returns true if the first character in the source string is a valid - # alphanumeric character for the encoding. - # - # @return [Boolean] + # Create a new RescueNode node. # - # source://prism//lib/prism/debug.rb#232 - def alnum?(source); end + # source://prism//lib/prism/dsl.rb#717 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + exceptions: T::Array[Prism::Node], + operator_loc: T.nilable(Prism::Location), + reference: T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)), + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(Prism::RescueNode) + ).returns(Prism::RescueNode) + end + def rescue_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil)); end - # Returns true if the first character in the source string is a valid - # alphabetic character for the encoding. - # - # @return [Boolean] + # Create a new RestParameterNode node. # - # source://prism//lib/prism/debug.rb#238 - def alpha?(source); end + # source://prism//lib/prism/dsl.rb#722 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location + ).returns(Prism::RestParameterNode) + end + def rest_parameter_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Whether or not the encoding is a multibyte encoding. + # Create a new RetryNode node. # - # @return [Boolean] - # - # source://prism//lib/prism/debug.rb#220 - def multibyte?; end + # source://prism//lib/prism/dsl.rb#727 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::RetryNode) + end + def retry_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # The name of the encoding, that can be passed to Encoding.find. + # Create a new ReturnNode node. # - # source://prism//lib/prism/debug.rb#210 - def name; end + # source://prism//lib/prism/dsl.rb#732 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode) + ).returns(Prism::ReturnNode) + end + def return_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil)); end - # Returns true if the first character in the source string is a valid - # uppercase character for the encoding. + # Create a new SelfNode node. # - # @return [Boolean] + # source://prism//lib/prism/dsl.rb#737 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::SelfNode) + end + def self_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + + # Create a new ShareableConstantNode node. # - # source://prism//lib/prism/debug.rb#244 - def upper?(source); end + # source://prism//lib/prism/dsl.rb#742 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + write: T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode) + ).returns(Prism::ShareableConstantNode) + end + def shareable_constant_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), write: T.unsafe(nil)); end - # Returns the number of bytes of the first character in the source string, - # if it is valid for the encoding. Otherwise, returns 0. + # Retrieve the value of one of the ShareableConstantNodeFlags flags. # - # source://prism//lib/prism/debug.rb#226 - def width(source); end + # source://prism//lib/prism/dsl.rb#950 + sig { params(name: Symbol).returns(Integer) } + def shareable_constant_node_flag(name); end - class << self - def _alnum?(_arg0, _arg1); end - def _alpha?(_arg0, _arg1); end - def _upper?(_arg0, _arg1); end - def _width(_arg0, _arg1); end - def all; end + # Create a new SingletonClassNode node. + # + # source://prism//lib/prism/dsl.rb#747 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + operator_loc: Prism::Location, + expression: Prism::Node, + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location + ).returns(Prism::SingletonClassNode) end -end + def singleton_class_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end -# A wrapper around a RubyVM::InstructionSequence that provides a more -# convenient interface for accessing parts of the iseq. -# -# source://prism//lib/prism/debug.rb#9 -class Prism::Debug::ISeq - # @return [ISeq] a new instance of ISeq + # Create a new Source object. # - # source://prism//lib/prism/debug.rb#12 - def initialize(parts); end + # source://prism//lib/prism/dsl.rb#67 + sig { params(string: String).returns(Prism::Source) } + def source(string); end - # source://prism//lib/prism/debug.rb#28 - def each_child; end + # Create a new SourceEncodingNode node. + # + # source://prism//lib/prism/dsl.rb#752 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::SourceEncodingNode) + end + def source_encoding_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # source://prism//lib/prism/debug.rb#24 - def instructions; end + # Create a new SourceFileNode node. + # + # source://prism//lib/prism/dsl.rb#757 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + filepath: String + ).returns(Prism::SourceFileNode) + end + def source_file_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), filepath: T.unsafe(nil)); end - # source://prism//lib/prism/debug.rb#20 - def local_table; end + # Create a new SourceLineNode node. + # + # source://prism//lib/prism/dsl.rb#762 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::SourceLineNode) + end + def source_line_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # source://prism//lib/prism/debug.rb#10 - def parts; end + # Create a new SplatNode node. + # + # source://prism//lib/prism/dsl.rb#767 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + expression: T.nilable(Prism::Node) + ).returns(Prism::SplatNode) + end + def splat_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil)); end - # source://prism//lib/prism/debug.rb#16 - def type; end + # Create a new StatementsNode node. + # + # source://prism//lib/prism/dsl.rb#772 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T::Array[Prism::Node] + ).returns(Prism::StatementsNode) + end + def statements_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil)); end + + # Retrieve the value of one of the StringFlags flags. + # + # source://prism//lib/prism/dsl.rb#960 + sig { params(name: Symbol).returns(Integer) } + def string_flag(name); end + + # Create a new StringNode node. + # + # source://prism//lib/prism/dsl.rb#777 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + content_loc: Prism::Location, + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).returns(Prism::StringNode) + end + def string_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + + # Create a new SuperNode node. + # + # source://prism//lib/prism/dsl.rb#782 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).returns(Prism::SuperNode) + end + def super_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil)); end + + # Retrieve the value of one of the SymbolFlags flags. + # + # source://prism//lib/prism/dsl.rb#971 + sig { params(name: Symbol).returns(Integer) } + def symbol_flag(name); end + + # Create a new SymbolNode node. + # + # source://prism//lib/prism/dsl.rb#787 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + value_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).returns(Prism::SymbolNode) + end + def symbol_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), value_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + + # Create a new TrueNode node. + # + # source://prism//lib/prism/dsl.rb#792 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer + ).returns(Prism::TrueNode) + end + def true_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + + # Create a new UndefNode node. + # + # source://prism//lib/prism/dsl.rb#797 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + names: T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)], + keyword_loc: Prism::Location + ).returns(Prism::UndefNode) + end + def undef_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), names: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + + # Create a new UnlessNode node. + # + # source://prism//lib/prism/dsl.rb#802 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + else_clause: T.nilable(Prism::ElseNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::UnlessNode) + end + def unless_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), else_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + + # Create a new UntilNode node. + # + # source://prism//lib/prism/dsl.rb#807 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location), + predicate: Prism::Node, + statements: T.nilable(Prism::StatementsNode) + ).returns(Prism::UntilNode) + end + def until_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end + + # Create a new WhenNode node. + # + # source://prism//lib/prism/dsl.rb#812 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + conditions: T::Array[Prism::Node], + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode) + ).returns(Prism::WhenNode) + end + def when_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil)); end + + # Create a new WhileNode node. + # + # source://prism//lib/prism/dsl.rb#817 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location), + predicate: Prism::Node, + statements: T.nilable(Prism::StatementsNode) + ).returns(Prism::WhileNode) + end + def while_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end + + # Create a new XStringNode node. + # + # source://prism//lib/prism/dsl.rb#822 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).returns(Prism::XStringNode) + end + def x_string_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + + # Create a new YieldNode node. + # + # source://prism//lib/prism/dsl.rb#827 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location) + ).returns(Prism::YieldNode) + end + def yield_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end + + private + + # The default location object that gets attached to nodes if no location is + # specified, which uses the given source. + # + # source://prism//lib/prism/dsl.rb#990 + sig { returns(Prism::Location) } + def default_location; end + + # The default node that gets attached to nodes if no node is specified for a + # required node field. + # + # source://prism//lib/prism/dsl.rb#996 + sig { params(source: Prism::Source, location: Prism::Location).returns(Prism::Node) } + def default_node(source, location); end + + # The default source object that gets attached to nodes and locations if no + # source is specified. + # + # source://prism//lib/prism/dsl.rb#984 + sig { returns(Prism::Source) } + def default_source; end end # Represents a method definition. @@ -9281,243 +11274,271 @@ end # end # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#6177 +# source://prism//lib/prism/node.rb#5886 class Prism::DefNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Prism::node? receiver, ParametersNode? parameters, Prism::node? body, Array[Symbol] locals, Location def_keyword_loc, Location? operator_loc, Location? lparen_loc, Location? rparen_loc, Location? equal_loc, Location? end_keyword_loc, Location location) -> void + # Initialize a new DefNode node. # # @return [DefNode] a new instance of DefNode # - # source://prism//lib/prism/node.rb#6179 + # source://prism//lib/prism/node.rb#5888 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, receiver: T.nilable(Prism::Node), parameters: T.nilable(Prism::ParametersNode), - body: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Prism::Location, operator_loc: T.nilable(Prism::Location), lparen_loc: T.nilable(Prism::Location), rparen_loc: T.nilable(Prism::Location), equal_loc: T.nilable(Prism::Location), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).void end - def initialize(source, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6421 + # source://prism//lib/prism/node.rb#6127 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6198 + # source://prism//lib/prism/node.rb#5908 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? + # attr_reader body: StatementsNode | BeginNode | nil # - # source://prism//lib/prism/node.rb#6251 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#5967 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6203 + # source://prism//lib/prism/node.rb#5913 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6217 + # source://prism//lib/prism/node.rb#5927 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6208 + # source://prism//lib/prism/node.rb#5918 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: Prism::node?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?, ?location: Location) -> DefNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: StatementsNode | BeginNode | nil, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode # - # source://prism//lib/prism/node.rb#6222 + # source://prism//lib/prism/node.rb#5932 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, receiver: T.nilable(Prism::Node), parameters: T.nilable(Prism::ParametersNode), - body: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Prism::Location, operator_loc: T.nilable(Prism::Location), lparen_loc: T.nilable(Prism::Location), rparen_loc: T.nilable(Prism::Location), equal_loc: T.nilable(Prism::Location), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).returns(Prism::DefNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6203 + # source://prism//lib/prism/node.rb#5913 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, receiver: Prism::node?, parameters: ParametersNode?, body: Prism::node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, receiver: Prism::node?, parameters: ParametersNode?, body: StatementsNode | BeginNode | nil, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location? } # - # source://prism//lib/prism/node.rb#6230 + # source://prism//lib/prism/node.rb#5940 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def def_keyword: () -> String # - # source://prism//lib/prism/node.rb#6329 + # source://prism//lib/prism/node.rb#6081 sig { returns(String) } def def_keyword; end # attr_reader def_keyword_loc: Location # - # source://prism//lib/prism/node.rb#6257 + # source://prism//lib/prism/node.rb#5973 sig { returns(Prism::Location) } def def_keyword_loc; end # def end_keyword: () -> String? # - # source://prism//lib/prism/node.rb#6354 + # source://prism//lib/prism/node.rb#6106 sig { returns(T.nilable(String)) } def end_keyword; end # attr_reader end_keyword_loc: Location? # - # source://prism//lib/prism/node.rb#6316 + # source://prism//lib/prism/node.rb#6062 sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end # def equal: () -> String? # - # source://prism//lib/prism/node.rb#6349 + # source://prism//lib/prism/node.rb#6101 sig { returns(T.nilable(String)) } def equal; end # attr_reader equal_loc: Location? # - # source://prism//lib/prism/node.rb#6303 + # source://prism//lib/prism/node.rb#6043 sig { returns(T.nilable(Prism::Location)) } def equal_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#6359 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6111 + sig { override.returns(String) } + def inspect; end # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/node.rb#6254 + # source://prism//lib/prism/node.rb#5970 sig { returns(T::Array[Symbol]) } def locals; end # def lparen: () -> String? # - # source://prism//lib/prism/node.rb#6339 + # source://prism//lib/prism/node.rb#6091 sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # - # source://prism//lib/prism/node.rb#6277 + # source://prism//lib/prism/node.rb#6005 sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#6235 + # source://prism//lib/prism/node.rb#5945 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#6238 + # source://prism//lib/prism/node.rb#5948 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String? # - # source://prism//lib/prism/node.rb#6334 + # source://prism//lib/prism/node.rb#6086 sig { returns(T.nilable(String)) } def operator; end # attr_reader operator_loc: Location? # - # source://prism//lib/prism/node.rb#6264 + # source://prism//lib/prism/node.rb#5986 sig { returns(T.nilable(Prism::Location)) } def operator_loc; end # attr_reader parameters: ParametersNode? # - # source://prism//lib/prism/node.rb#6248 + # source://prism//lib/prism/node.rb#5964 sig { returns(T.nilable(Prism::ParametersNode)) } def parameters; end # attr_reader receiver: Prism::node? # - # source://prism//lib/prism/node.rb#6245 + # source://prism//lib/prism/node.rb#5961 sig { returns(T.nilable(Prism::Node)) } def receiver; end # def rparen: () -> String? # - # source://prism//lib/prism/node.rb#6344 + # source://prism//lib/prism/node.rb#6096 sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # - # source://prism//lib/prism/node.rb#6290 + # source://prism//lib/prism/node.rb#6024 sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the def_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#5981 + def save_def_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6076 + def save_end_keyword_loc(repository); end + + # Save the equal_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6057 + def save_equal_loc(repository); end + + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6019 + def save_lparen_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#5956 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6000 + def save_operator_loc(repository); end + + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#6038 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#6405 + # source://prism//lib/prism/node.rb#6116 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#6415 + # source://prism//lib/prism/node.rb#6121 def type; end end end @@ -9527,217 +11548,221 @@ end # defined?(a) # ^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#6443 +# source://prism//lib/prism/node.rb#6149 class Prism::DefinedNode < ::Prism::Node - # def initialize: (Location? lparen_loc, Prism::node value, Location? rparen_loc, Location keyword_loc, Location location) -> void + # Initialize a new DefinedNode node. # # @return [DefinedNode] a new instance of DefinedNode # - # source://prism//lib/prism/node.rb#6445 + # source://prism//lib/prism/node.rb#6151 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, lparen_loc: T.nilable(Prism::Location), value: Prism::Node, rparen_loc: T.nilable(Prism::Location), - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).void end - def initialize(source, lparen_loc, value, rparen_loc, keyword_loc, location); end + def initialize(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6580 + # source://prism//lib/prism/node.rb#6281 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6456 + # source://prism//lib/prism/node.rb#6163 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6461 + # source://prism//lib/prism/node.rb#6168 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6471 + # source://prism//lib/prism/node.rb#6178 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6466 + # source://prism//lib/prism/node.rb#6173 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location, ?location: Location) -> DefinedNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode # - # source://prism//lib/prism/node.rb#6476 + # source://prism//lib/prism/node.rb#6183 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, lparen_loc: T.nilable(Prism::Location), value: Prism::Node, rparen_loc: T.nilable(Prism::Location), - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).returns(Prism::DefinedNode) end - def copy(lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6461 + # source://prism//lib/prism/node.rb#6168 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { lparen_loc: Location?, value: Prism::node, rparen_loc: Location?, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lparen_loc: Location?, value: Prism::node, rparen_loc: Location?, keyword_loc: Location } # - # source://prism//lib/prism/node.rb#6484 + # source://prism//lib/prism/node.rb#6191 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#6540 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6265 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#6535 + # source://prism//lib/prism/node.rb#6260 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#6518 + # source://prism//lib/prism/node.rb#6237 sig { returns(Prism::Location) } def keyword_loc; end # def lparen: () -> String? # - # source://prism//lib/prism/node.rb#6525 + # source://prism//lib/prism/node.rb#6250 sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # - # source://prism//lib/prism/node.rb#6489 + # source://prism//lib/prism/node.rb#6196 sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def rparen: () -> String? # - # source://prism//lib/prism/node.rb#6530 + # source://prism//lib/prism/node.rb#6255 sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # - # source://prism//lib/prism/node.rb#6505 + # source://prism//lib/prism/node.rb#6218 sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#6245 + def save_keyword_loc(repository); end + + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6210 + def save_lparen_loc(repository); end + + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#6232 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#6564 + # source://prism//lib/prism/node.rb#6270 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#6502 + # source://prism//lib/prism/node.rb#6215 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#6574 + # source://prism//lib/prism/node.rb#6275 def type; end end end # source://prism//lib/prism/desugar_compiler.rb#4 class Prism::DesugarAndWriteNode + include ::Prism::DSL + # @return [DesugarAndWriteNode] a new instance of DesugarAndWriteNode # - # source://prism//lib/prism/desugar_compiler.rb#7 - def initialize(node, source, read_class, write_class, *arguments); end + # source://prism//lib/prism/desugar_compiler.rb#9 + def initialize(node, default_source, read_class, write_class, **arguments); end # Returns the value of attribute arguments. # - # source://prism//lib/prism/desugar_compiler.rb#5 + # source://prism//lib/prism/desugar_compiler.rb#7 def arguments; end # Desugar `x &&= y` to `x && x = y` # - # source://prism//lib/prism/desugar_compiler.rb#16 + # source://prism//lib/prism/desugar_compiler.rb#18 def compile; end + # Returns the value of attribute default_source. + # + # source://prism//lib/prism/desugar_compiler.rb#7 + def default_source; end + # Returns the value of attribute node. # - # source://prism//lib/prism/desugar_compiler.rb#5 + # source://prism//lib/prism/desugar_compiler.rb#7 def node; end # Returns the value of attribute read_class. # - # source://prism//lib/prism/desugar_compiler.rb#5 + # source://prism//lib/prism/desugar_compiler.rb#7 def read_class; end - # Returns the value of attribute source. - # - # source://prism//lib/prism/desugar_compiler.rb#5 - def source; end - # Returns the value of attribute write_class. # - # source://prism//lib/prism/desugar_compiler.rb#5 + # source://prism//lib/prism/desugar_compiler.rb#7 def write_class; end end # DesugarCompiler is a compiler that desugars Ruby code into a more primitive # form. This is useful for consumers that want to deal with fewer node types. # -# source://prism//lib/prism/desugar_compiler.rb#218 +# source://prism//lib/prism/desugar_compiler.rb#255 class Prism::DesugarCompiler < ::Prism::MutationCompiler - Result = type_member { { fixed: Prism::Node } } - # @@foo &&= bar # # becomes # # @@foo && @@foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#224 + # source://prism//lib/prism/desugar_compiler.rb#261 def visit_class_variable_and_write_node(node); end # @@foo += bar @@ -9746,7 +11771,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # @@foo = @@foo + bar # - # source://prism//lib/prism/desugar_compiler.rb#242 + # source://prism//lib/prism/desugar_compiler.rb#279 def visit_class_variable_operator_write_node(node); end # @@foo ||= bar @@ -9755,7 +11780,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # defined?(@@foo) ? @@foo : @@foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#233 + # source://prism//lib/prism/desugar_compiler.rb#270 def visit_class_variable_or_write_node(node); end # Foo &&= bar @@ -9764,7 +11789,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # Foo && Foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#251 + # source://prism//lib/prism/desugar_compiler.rb#288 def visit_constant_and_write_node(node); end # Foo += bar @@ -9773,7 +11798,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # Foo = Foo + bar # - # source://prism//lib/prism/desugar_compiler.rb#269 + # source://prism//lib/prism/desugar_compiler.rb#306 def visit_constant_operator_write_node(node); end # Foo ||= bar @@ -9782,7 +11807,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # defined?(Foo) ? Foo : Foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#260 + # source://prism//lib/prism/desugar_compiler.rb#297 def visit_constant_or_write_node(node); end # $foo &&= bar @@ -9791,7 +11816,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # $foo && $foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#278 + # source://prism//lib/prism/desugar_compiler.rb#315 def visit_global_variable_and_write_node(node); end # $foo += bar @@ -9800,7 +11825,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # $foo = $foo + bar # - # source://prism//lib/prism/desugar_compiler.rb#296 + # source://prism//lib/prism/desugar_compiler.rb#333 def visit_global_variable_operator_write_node(node); end # $foo ||= bar @@ -9809,22 +11834,22 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # defined?($foo) ? $foo : $foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#287 + # source://prism//lib/prism/desugar_compiler.rb#324 def visit_global_variable_or_write_node(node); end # becomes # - # source://prism//lib/prism/desugar_compiler.rb#305 + # source://prism//lib/prism/desugar_compiler.rb#342 def visit_instance_variable_and_write_node(node); end # becomes # - # source://prism//lib/prism/desugar_compiler.rb#323 + # source://prism//lib/prism/desugar_compiler.rb#360 def visit_instance_variable_operator_write_node(node); end # becomes # - # source://prism//lib/prism/desugar_compiler.rb#314 + # source://prism//lib/prism/desugar_compiler.rb#351 def visit_instance_variable_or_write_node(node); end # foo &&= bar @@ -9833,7 +11858,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # foo && foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#332 + # source://prism//lib/prism/desugar_compiler.rb#369 def visit_local_variable_and_write_node(node); end # foo += bar @@ -9842,7 +11867,7 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # foo = foo + bar # - # source://prism//lib/prism/desugar_compiler.rb#350 + # source://prism//lib/prism/desugar_compiler.rb#387 def visit_local_variable_operator_write_node(node); end # foo ||= bar @@ -9851,121 +11876,127 @@ class Prism::DesugarCompiler < ::Prism::MutationCompiler # # foo || foo = bar # - # source://prism//lib/prism/desugar_compiler.rb#341 + # source://prism//lib/prism/desugar_compiler.rb#378 def visit_local_variable_or_write_node(node); end end -# source://prism//lib/prism/desugar_compiler.rb#63 +# source://prism//lib/prism/desugar_compiler.rb#86 class Prism::DesugarOperatorWriteNode + include ::Prism::DSL + # @return [DesugarOperatorWriteNode] a new instance of DesugarOperatorWriteNode # - # source://prism//lib/prism/desugar_compiler.rb#66 - def initialize(node, source, read_class, write_class, *arguments); end + # source://prism//lib/prism/desugar_compiler.rb#91 + def initialize(node, default_source, read_class, write_class, **arguments); end # Returns the value of attribute arguments. # - # source://prism//lib/prism/desugar_compiler.rb#64 + # source://prism//lib/prism/desugar_compiler.rb#89 def arguments; end # Desugar `x += y` to `x = x + y` # - # source://prism//lib/prism/desugar_compiler.rb#75 + # source://prism//lib/prism/desugar_compiler.rb#100 def compile; end + # Returns the value of attribute default_source. + # + # source://prism//lib/prism/desugar_compiler.rb#89 + def default_source; end + # Returns the value of attribute node. # - # source://prism//lib/prism/desugar_compiler.rb#64 + # source://prism//lib/prism/desugar_compiler.rb#89 def node; end # Returns the value of attribute read_class. # - # source://prism//lib/prism/desugar_compiler.rb#64 + # source://prism//lib/prism/desugar_compiler.rb#89 def read_class; end - # Returns the value of attribute source. + # Returns the value of attribute write_class. # - # source://prism//lib/prism/desugar_compiler.rb#64 - def source; end - - # Returns the value of attribute write_class. - # - # source://prism//lib/prism/desugar_compiler.rb#64 + # source://prism//lib/prism/desugar_compiler.rb#89 def write_class; end end -# source://prism//lib/prism/desugar_compiler.rb#27 +# source://prism//lib/prism/desugar_compiler.rb#35 class Prism::DesugarOrWriteDefinedNode + include ::Prism::DSL + # @return [DesugarOrWriteDefinedNode] a new instance of DesugarOrWriteDefinedNode # - # source://prism//lib/prism/desugar_compiler.rb#30 - def initialize(node, source, read_class, write_class, *arguments); end + # source://prism//lib/prism/desugar_compiler.rb#40 + def initialize(node, default_source, read_class, write_class, **arguments); end # Returns the value of attribute arguments. # - # source://prism//lib/prism/desugar_compiler.rb#28 + # source://prism//lib/prism/desugar_compiler.rb#38 def arguments; end # Desugar `x ||= y` to `defined?(x) ? x : x = y` # - # source://prism//lib/prism/desugar_compiler.rb#39 + # source://prism//lib/prism/desugar_compiler.rb#49 def compile; end + # Returns the value of attribute default_source. + # + # source://prism//lib/prism/desugar_compiler.rb#38 + def default_source; end + # Returns the value of attribute node. # - # source://prism//lib/prism/desugar_compiler.rb#28 + # source://prism//lib/prism/desugar_compiler.rb#38 def node; end # Returns the value of attribute read_class. # - # source://prism//lib/prism/desugar_compiler.rb#28 + # source://prism//lib/prism/desugar_compiler.rb#38 def read_class; end - # Returns the value of attribute source. - # - # source://prism//lib/prism/desugar_compiler.rb#28 - def source; end - # Returns the value of attribute write_class. # - # source://prism//lib/prism/desugar_compiler.rb#28 + # source://prism//lib/prism/desugar_compiler.rb#38 def write_class; end end -# source://prism//lib/prism/desugar_compiler.rb#101 +# source://prism//lib/prism/desugar_compiler.rb#130 class Prism::DesugarOrWriteNode + include ::Prism::DSL + # @return [DesugarOrWriteNode] a new instance of DesugarOrWriteNode # - # source://prism//lib/prism/desugar_compiler.rb#104 - def initialize(node, source, read_class, write_class, *arguments); end + # source://prism//lib/prism/desugar_compiler.rb#135 + def initialize(node, default_source, read_class, write_class, **arguments); end # Returns the value of attribute arguments. # - # source://prism//lib/prism/desugar_compiler.rb#102 + # source://prism//lib/prism/desugar_compiler.rb#133 def arguments; end # Desugar `x ||= y` to `x || x = y` # - # source://prism//lib/prism/desugar_compiler.rb#113 + # source://prism//lib/prism/desugar_compiler.rb#144 def compile; end + # Returns the value of attribute default_source. + # + # source://prism//lib/prism/desugar_compiler.rb#133 + def default_source; end + # Returns the value of attribute node. # - # source://prism//lib/prism/desugar_compiler.rb#102 + # source://prism//lib/prism/desugar_compiler.rb#133 def node; end # Returns the value of attribute read_class. # - # source://prism//lib/prism/desugar_compiler.rb#102 + # source://prism//lib/prism/desugar_compiler.rb#133 def read_class; end - # Returns the value of attribute source. - # - # source://prism//lib/prism/desugar_compiler.rb#102 - def source; end - # Returns the value of attribute write_class. # - # source://prism//lib/prism/desugar_compiler.rb#102 + # source://prism//lib/prism/desugar_compiler.rb#133 def write_class; end end @@ -9984,7 +12015,8 @@ end # end # end # -# dispatcher = Dispatcher.new +# listener = OctalListener.new +# dispatcher = Prism::Dispatcher.new # dispatcher.register(listener, :on_integer_node_enter) # # Then, you can walk any number of trees and dispatch events to the listeners: @@ -10000,13 +12032,13 @@ end # integer = result.value.statements.body.first.receiver.receiver # dispatcher.dispatch_once(integer) # -# source://prism//lib/prism/dispatcher.rb#41 +# source://prism//lib/prism/dispatcher.rb#42 class Prism::Dispatcher < ::Prism::Visitor # Initialize a new dispatcher. # # @return [Dispatcher] a new instance of Dispatcher # - # source://prism//lib/prism/dispatcher.rb#46 + # source://prism//lib/prism/dispatcher.rb#47 def initialize; end # Walks `root` dispatching events to all registered listeners. @@ -10020,1682 +12052,1693 @@ class Prism::Dispatcher < ::Prism::Visitor # # def dispatch_once: (Node) -> void # - # source://prism//lib/prism/dispatcher.rb#65 + # source://prism//lib/prism/dispatcher.rb#66 def dispatch_once(node); end # attr_reader listeners: Hash[Symbol, Array[Listener]] # - # source://prism//lib/prism/dispatcher.rb#43 + # source://prism//lib/prism/dispatcher.rb#44 def listeners; end # Register a listener for one or more events. # # def register: (Listener, *Symbol) -> void # - # source://prism//lib/prism/dispatcher.rb#53 + # source://prism//lib/prism/dispatcher.rb#54 def register(listener, *events); end # Dispatch enter and leave events for AliasGlobalVariableNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#71 + # source://prism//lib/prism/dispatcher.rb#72 def visit_alias_global_variable_node(node); end # Dispatch enter and leave events for AliasMethodNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#79 + # source://prism//lib/prism/dispatcher.rb#80 def visit_alias_method_node(node); end # Dispatch enter and leave events for AlternationPatternNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#87 + # source://prism//lib/prism/dispatcher.rb#88 def visit_alternation_pattern_node(node); end # Dispatch enter and leave events for AndNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#95 + # source://prism//lib/prism/dispatcher.rb#96 def visit_and_node(node); end # Dispatch enter and leave events for ArgumentsNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#103 + # source://prism//lib/prism/dispatcher.rb#104 def visit_arguments_node(node); end # Dispatch enter and leave events for ArrayNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#111 + # source://prism//lib/prism/dispatcher.rb#112 def visit_array_node(node); end # Dispatch enter and leave events for ArrayPatternNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#119 + # source://prism//lib/prism/dispatcher.rb#120 def visit_array_pattern_node(node); end # Dispatch enter and leave events for AssocNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#127 + # source://prism//lib/prism/dispatcher.rb#128 def visit_assoc_node(node); end # Dispatch enter and leave events for AssocSplatNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#135 + # source://prism//lib/prism/dispatcher.rb#136 def visit_assoc_splat_node(node); end # Dispatch enter and leave events for BackReferenceReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#143 + # source://prism//lib/prism/dispatcher.rb#144 def visit_back_reference_read_node(node); end # Dispatch enter and leave events for BeginNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#151 + # source://prism//lib/prism/dispatcher.rb#152 def visit_begin_node(node); end # Dispatch enter and leave events for BlockArgumentNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#159 + # source://prism//lib/prism/dispatcher.rb#160 def visit_block_argument_node(node); end # Dispatch enter and leave events for BlockLocalVariableNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#167 + # source://prism//lib/prism/dispatcher.rb#168 def visit_block_local_variable_node(node); end # Dispatch enter and leave events for BlockNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#175 + # source://prism//lib/prism/dispatcher.rb#176 def visit_block_node(node); end # Dispatch enter and leave events for BlockParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#183 + # source://prism//lib/prism/dispatcher.rb#184 def visit_block_parameter_node(node); end # Dispatch enter and leave events for BlockParametersNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#191 + # source://prism//lib/prism/dispatcher.rb#192 def visit_block_parameters_node(node); end # Dispatch enter and leave events for BreakNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#199 + # source://prism//lib/prism/dispatcher.rb#200 def visit_break_node(node); end # Dispatch enter and leave events for CallAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#207 + # source://prism//lib/prism/dispatcher.rb#208 def visit_call_and_write_node(node); end # Dispatch enter and leave events for CallNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#215 + # source://prism//lib/prism/dispatcher.rb#216 def visit_call_node(node); end # Dispatch enter and leave events for CallOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#223 + # source://prism//lib/prism/dispatcher.rb#224 def visit_call_operator_write_node(node); end # Dispatch enter and leave events for CallOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#231 + # source://prism//lib/prism/dispatcher.rb#232 def visit_call_or_write_node(node); end # Dispatch enter and leave events for CallTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#239 + # source://prism//lib/prism/dispatcher.rb#240 def visit_call_target_node(node); end # Dispatch enter and leave events for CapturePatternNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#247 + # source://prism//lib/prism/dispatcher.rb#248 def visit_capture_pattern_node(node); end # Dispatch enter and leave events for CaseMatchNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#255 + # source://prism//lib/prism/dispatcher.rb#256 def visit_case_match_node(node); end # Dispatch enter and leave events for CaseNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#263 + # source://prism//lib/prism/dispatcher.rb#264 def visit_case_node(node); end # Dispatch enter and leave events for ClassNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#271 + # source://prism//lib/prism/dispatcher.rb#272 def visit_class_node(node); end # Dispatch enter and leave events for ClassVariableAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#279 + # source://prism//lib/prism/dispatcher.rb#280 def visit_class_variable_and_write_node(node); end # Dispatch enter and leave events for ClassVariableOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#287 + # source://prism//lib/prism/dispatcher.rb#288 def visit_class_variable_operator_write_node(node); end # Dispatch enter and leave events for ClassVariableOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#295 + # source://prism//lib/prism/dispatcher.rb#296 def visit_class_variable_or_write_node(node); end # Dispatch enter and leave events for ClassVariableReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#303 + # source://prism//lib/prism/dispatcher.rb#304 def visit_class_variable_read_node(node); end # Dispatch enter and leave events for ClassVariableTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#311 + # source://prism//lib/prism/dispatcher.rb#312 def visit_class_variable_target_node(node); end # Dispatch enter and leave events for ClassVariableWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#319 + # source://prism//lib/prism/dispatcher.rb#320 def visit_class_variable_write_node(node); end # Dispatch enter and leave events for ConstantAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#327 + # source://prism//lib/prism/dispatcher.rb#328 def visit_constant_and_write_node(node); end # Dispatch enter and leave events for ConstantOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#335 + # source://prism//lib/prism/dispatcher.rb#336 def visit_constant_operator_write_node(node); end # Dispatch enter and leave events for ConstantOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#343 + # source://prism//lib/prism/dispatcher.rb#344 def visit_constant_or_write_node(node); end # Dispatch enter and leave events for ConstantPathAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#351 + # source://prism//lib/prism/dispatcher.rb#352 def visit_constant_path_and_write_node(node); end # Dispatch enter and leave events for ConstantPathNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#359 + # source://prism//lib/prism/dispatcher.rb#360 def visit_constant_path_node(node); end # Dispatch enter and leave events for ConstantPathOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#367 + # source://prism//lib/prism/dispatcher.rb#368 def visit_constant_path_operator_write_node(node); end # Dispatch enter and leave events for ConstantPathOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#375 + # source://prism//lib/prism/dispatcher.rb#376 def visit_constant_path_or_write_node(node); end # Dispatch enter and leave events for ConstantPathTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#383 + # source://prism//lib/prism/dispatcher.rb#384 def visit_constant_path_target_node(node); end # Dispatch enter and leave events for ConstantPathWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#391 + # source://prism//lib/prism/dispatcher.rb#392 def visit_constant_path_write_node(node); end # Dispatch enter and leave events for ConstantReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#399 + # source://prism//lib/prism/dispatcher.rb#400 def visit_constant_read_node(node); end # Dispatch enter and leave events for ConstantTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#407 + # source://prism//lib/prism/dispatcher.rb#408 def visit_constant_target_node(node); end # Dispatch enter and leave events for ConstantWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#415 + # source://prism//lib/prism/dispatcher.rb#416 def visit_constant_write_node(node); end # Dispatch enter and leave events for DefNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#423 + # source://prism//lib/prism/dispatcher.rb#424 def visit_def_node(node); end # Dispatch enter and leave events for DefinedNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#431 + # source://prism//lib/prism/dispatcher.rb#432 def visit_defined_node(node); end # Dispatch enter and leave events for ElseNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#439 + # source://prism//lib/prism/dispatcher.rb#440 def visit_else_node(node); end # Dispatch enter and leave events for EmbeddedStatementsNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#447 + # source://prism//lib/prism/dispatcher.rb#448 def visit_embedded_statements_node(node); end # Dispatch enter and leave events for EmbeddedVariableNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#455 + # source://prism//lib/prism/dispatcher.rb#456 def visit_embedded_variable_node(node); end # Dispatch enter and leave events for EnsureNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#463 + # source://prism//lib/prism/dispatcher.rb#464 def visit_ensure_node(node); end # Dispatch enter and leave events for FalseNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#471 + # source://prism//lib/prism/dispatcher.rb#472 def visit_false_node(node); end # Dispatch enter and leave events for FindPatternNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#479 + # source://prism//lib/prism/dispatcher.rb#480 def visit_find_pattern_node(node); end # Dispatch enter and leave events for FlipFlopNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#487 + # source://prism//lib/prism/dispatcher.rb#488 def visit_flip_flop_node(node); end # Dispatch enter and leave events for FloatNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#495 + # source://prism//lib/prism/dispatcher.rb#496 def visit_float_node(node); end # Dispatch enter and leave events for ForNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#503 + # source://prism//lib/prism/dispatcher.rb#504 def visit_for_node(node); end # Dispatch enter and leave events for ForwardingArgumentsNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#511 + # source://prism//lib/prism/dispatcher.rb#512 def visit_forwarding_arguments_node(node); end # Dispatch enter and leave events for ForwardingParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#519 + # source://prism//lib/prism/dispatcher.rb#520 def visit_forwarding_parameter_node(node); end # Dispatch enter and leave events for ForwardingSuperNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#527 + # source://prism//lib/prism/dispatcher.rb#528 def visit_forwarding_super_node(node); end # Dispatch enter and leave events for GlobalVariableAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#535 + # source://prism//lib/prism/dispatcher.rb#536 def visit_global_variable_and_write_node(node); end # Dispatch enter and leave events for GlobalVariableOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#543 + # source://prism//lib/prism/dispatcher.rb#544 def visit_global_variable_operator_write_node(node); end # Dispatch enter and leave events for GlobalVariableOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#551 + # source://prism//lib/prism/dispatcher.rb#552 def visit_global_variable_or_write_node(node); end # Dispatch enter and leave events for GlobalVariableReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#559 + # source://prism//lib/prism/dispatcher.rb#560 def visit_global_variable_read_node(node); end # Dispatch enter and leave events for GlobalVariableTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#567 + # source://prism//lib/prism/dispatcher.rb#568 def visit_global_variable_target_node(node); end # Dispatch enter and leave events for GlobalVariableWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#575 + # source://prism//lib/prism/dispatcher.rb#576 def visit_global_variable_write_node(node); end # Dispatch enter and leave events for HashNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#583 + # source://prism//lib/prism/dispatcher.rb#584 def visit_hash_node(node); end # Dispatch enter and leave events for HashPatternNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#591 + # source://prism//lib/prism/dispatcher.rb#592 def visit_hash_pattern_node(node); end # Dispatch enter and leave events for IfNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#599 + # source://prism//lib/prism/dispatcher.rb#600 def visit_if_node(node); end # Dispatch enter and leave events for ImaginaryNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#607 + # source://prism//lib/prism/dispatcher.rb#608 def visit_imaginary_node(node); end # Dispatch enter and leave events for ImplicitNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#615 + # source://prism//lib/prism/dispatcher.rb#616 def visit_implicit_node(node); end # Dispatch enter and leave events for ImplicitRestNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#623 + # source://prism//lib/prism/dispatcher.rb#624 def visit_implicit_rest_node(node); end # Dispatch enter and leave events for InNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#631 + # source://prism//lib/prism/dispatcher.rb#632 def visit_in_node(node); end # Dispatch enter and leave events for IndexAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#639 + # source://prism//lib/prism/dispatcher.rb#640 def visit_index_and_write_node(node); end # Dispatch enter and leave events for IndexOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#647 + # source://prism//lib/prism/dispatcher.rb#648 def visit_index_operator_write_node(node); end # Dispatch enter and leave events for IndexOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#655 + # source://prism//lib/prism/dispatcher.rb#656 def visit_index_or_write_node(node); end # Dispatch enter and leave events for IndexTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#663 + # source://prism//lib/prism/dispatcher.rb#664 def visit_index_target_node(node); end # Dispatch enter and leave events for InstanceVariableAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#671 + # source://prism//lib/prism/dispatcher.rb#672 def visit_instance_variable_and_write_node(node); end # Dispatch enter and leave events for InstanceVariableOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#679 + # source://prism//lib/prism/dispatcher.rb#680 def visit_instance_variable_operator_write_node(node); end # Dispatch enter and leave events for InstanceVariableOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#687 + # source://prism//lib/prism/dispatcher.rb#688 def visit_instance_variable_or_write_node(node); end # Dispatch enter and leave events for InstanceVariableReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#695 + # source://prism//lib/prism/dispatcher.rb#696 def visit_instance_variable_read_node(node); end # Dispatch enter and leave events for InstanceVariableTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#703 + # source://prism//lib/prism/dispatcher.rb#704 def visit_instance_variable_target_node(node); end # Dispatch enter and leave events for InstanceVariableWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#711 + # source://prism//lib/prism/dispatcher.rb#712 def visit_instance_variable_write_node(node); end # Dispatch enter and leave events for IntegerNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#719 + # source://prism//lib/prism/dispatcher.rb#720 def visit_integer_node(node); end # Dispatch enter and leave events for InterpolatedMatchLastLineNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#727 + # source://prism//lib/prism/dispatcher.rb#728 def visit_interpolated_match_last_line_node(node); end # Dispatch enter and leave events for InterpolatedRegularExpressionNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#735 + # source://prism//lib/prism/dispatcher.rb#736 def visit_interpolated_regular_expression_node(node); end # Dispatch enter and leave events for InterpolatedStringNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#743 + # source://prism//lib/prism/dispatcher.rb#744 def visit_interpolated_string_node(node); end # Dispatch enter and leave events for InterpolatedSymbolNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#751 + # source://prism//lib/prism/dispatcher.rb#752 def visit_interpolated_symbol_node(node); end # Dispatch enter and leave events for InterpolatedXStringNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#759 + # source://prism//lib/prism/dispatcher.rb#760 def visit_interpolated_x_string_node(node); end + # Dispatch enter and leave events for ItLocalVariableReadNode nodes and continue + # walking the tree. + # + # source://prism//lib/prism/dispatcher.rb#768 + def visit_it_local_variable_read_node(node); end + # Dispatch enter and leave events for ItParametersNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#767 + # source://prism//lib/prism/dispatcher.rb#776 def visit_it_parameters_node(node); end # Dispatch enter and leave events for KeywordHashNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#775 + # source://prism//lib/prism/dispatcher.rb#784 def visit_keyword_hash_node(node); end # Dispatch enter and leave events for KeywordRestParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#783 + # source://prism//lib/prism/dispatcher.rb#792 def visit_keyword_rest_parameter_node(node); end # Dispatch enter and leave events for LambdaNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#791 + # source://prism//lib/prism/dispatcher.rb#800 def visit_lambda_node(node); end # Dispatch enter and leave events for LocalVariableAndWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#799 + # source://prism//lib/prism/dispatcher.rb#808 def visit_local_variable_and_write_node(node); end # Dispatch enter and leave events for LocalVariableOperatorWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#807 + # source://prism//lib/prism/dispatcher.rb#816 def visit_local_variable_operator_write_node(node); end # Dispatch enter and leave events for LocalVariableOrWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#815 + # source://prism//lib/prism/dispatcher.rb#824 def visit_local_variable_or_write_node(node); end # Dispatch enter and leave events for LocalVariableReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#823 + # source://prism//lib/prism/dispatcher.rb#832 def visit_local_variable_read_node(node); end # Dispatch enter and leave events for LocalVariableTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#831 + # source://prism//lib/prism/dispatcher.rb#840 def visit_local_variable_target_node(node); end # Dispatch enter and leave events for LocalVariableWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#839 + # source://prism//lib/prism/dispatcher.rb#848 def visit_local_variable_write_node(node); end # Dispatch enter and leave events for MatchLastLineNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#847 + # source://prism//lib/prism/dispatcher.rb#856 def visit_match_last_line_node(node); end # Dispatch enter and leave events for MatchPredicateNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#855 + # source://prism//lib/prism/dispatcher.rb#864 def visit_match_predicate_node(node); end # Dispatch enter and leave events for MatchRequiredNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#863 + # source://prism//lib/prism/dispatcher.rb#872 def visit_match_required_node(node); end # Dispatch enter and leave events for MatchWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#871 + # source://prism//lib/prism/dispatcher.rb#880 def visit_match_write_node(node); end # Dispatch enter and leave events for MissingNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#879 + # source://prism//lib/prism/dispatcher.rb#888 def visit_missing_node(node); end # Dispatch enter and leave events for ModuleNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#887 + # source://prism//lib/prism/dispatcher.rb#896 def visit_module_node(node); end # Dispatch enter and leave events for MultiTargetNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#895 + # source://prism//lib/prism/dispatcher.rb#904 def visit_multi_target_node(node); end # Dispatch enter and leave events for MultiWriteNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#903 + # source://prism//lib/prism/dispatcher.rb#912 def visit_multi_write_node(node); end # Dispatch enter and leave events for NextNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#911 + # source://prism//lib/prism/dispatcher.rb#920 def visit_next_node(node); end # Dispatch enter and leave events for NilNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#919 + # source://prism//lib/prism/dispatcher.rb#928 def visit_nil_node(node); end # Dispatch enter and leave events for NoKeywordsParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#927 + # source://prism//lib/prism/dispatcher.rb#936 def visit_no_keywords_parameter_node(node); end # Dispatch enter and leave events for NumberedParametersNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#935 + # source://prism//lib/prism/dispatcher.rb#944 def visit_numbered_parameters_node(node); end # Dispatch enter and leave events for NumberedReferenceReadNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#943 + # source://prism//lib/prism/dispatcher.rb#952 def visit_numbered_reference_read_node(node); end # Dispatch enter and leave events for OptionalKeywordParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#951 + # source://prism//lib/prism/dispatcher.rb#960 def visit_optional_keyword_parameter_node(node); end # Dispatch enter and leave events for OptionalParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#959 + # source://prism//lib/prism/dispatcher.rb#968 def visit_optional_parameter_node(node); end # Dispatch enter and leave events for OrNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#967 + # source://prism//lib/prism/dispatcher.rb#976 def visit_or_node(node); end # Dispatch enter and leave events for ParametersNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#975 + # source://prism//lib/prism/dispatcher.rb#984 def visit_parameters_node(node); end # Dispatch enter and leave events for ParenthesesNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#983 + # source://prism//lib/prism/dispatcher.rb#992 def visit_parentheses_node(node); end # Dispatch enter and leave events for PinnedExpressionNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#991 + # source://prism//lib/prism/dispatcher.rb#1000 def visit_pinned_expression_node(node); end # Dispatch enter and leave events for PinnedVariableNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#999 + # source://prism//lib/prism/dispatcher.rb#1008 def visit_pinned_variable_node(node); end # Dispatch enter and leave events for PostExecutionNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1007 + # source://prism//lib/prism/dispatcher.rb#1016 def visit_post_execution_node(node); end # Dispatch enter and leave events for PreExecutionNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1015 + # source://prism//lib/prism/dispatcher.rb#1024 def visit_pre_execution_node(node); end # Dispatch enter and leave events for ProgramNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1023 + # source://prism//lib/prism/dispatcher.rb#1032 def visit_program_node(node); end # Dispatch enter and leave events for RangeNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1031 + # source://prism//lib/prism/dispatcher.rb#1040 def visit_range_node(node); end # Dispatch enter and leave events for RationalNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1039 + # source://prism//lib/prism/dispatcher.rb#1048 def visit_rational_node(node); end # Dispatch enter and leave events for RedoNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1047 + # source://prism//lib/prism/dispatcher.rb#1056 def visit_redo_node(node); end # Dispatch enter and leave events for RegularExpressionNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1055 + # source://prism//lib/prism/dispatcher.rb#1064 def visit_regular_expression_node(node); end # Dispatch enter and leave events for RequiredKeywordParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1063 + # source://prism//lib/prism/dispatcher.rb#1072 def visit_required_keyword_parameter_node(node); end # Dispatch enter and leave events for RequiredParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1071 + # source://prism//lib/prism/dispatcher.rb#1080 def visit_required_parameter_node(node); end # Dispatch enter and leave events for RescueModifierNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1079 + # source://prism//lib/prism/dispatcher.rb#1088 def visit_rescue_modifier_node(node); end # Dispatch enter and leave events for RescueNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1087 + # source://prism//lib/prism/dispatcher.rb#1096 def visit_rescue_node(node); end # Dispatch enter and leave events for RestParameterNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1095 + # source://prism//lib/prism/dispatcher.rb#1104 def visit_rest_parameter_node(node); end # Dispatch enter and leave events for RetryNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1103 + # source://prism//lib/prism/dispatcher.rb#1112 def visit_retry_node(node); end # Dispatch enter and leave events for ReturnNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1111 + # source://prism//lib/prism/dispatcher.rb#1120 def visit_return_node(node); end # Dispatch enter and leave events for SelfNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1119 + # source://prism//lib/prism/dispatcher.rb#1128 def visit_self_node(node); end # Dispatch enter and leave events for ShareableConstantNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1127 + # source://prism//lib/prism/dispatcher.rb#1136 def visit_shareable_constant_node(node); end # Dispatch enter and leave events for SingletonClassNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1135 + # source://prism//lib/prism/dispatcher.rb#1144 def visit_singleton_class_node(node); end # Dispatch enter and leave events for SourceEncodingNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1143 + # source://prism//lib/prism/dispatcher.rb#1152 def visit_source_encoding_node(node); end # Dispatch enter and leave events for SourceFileNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1151 + # source://prism//lib/prism/dispatcher.rb#1160 def visit_source_file_node(node); end # Dispatch enter and leave events for SourceLineNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1159 + # source://prism//lib/prism/dispatcher.rb#1168 def visit_source_line_node(node); end # Dispatch enter and leave events for SplatNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1167 + # source://prism//lib/prism/dispatcher.rb#1176 def visit_splat_node(node); end # Dispatch enter and leave events for StatementsNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1175 + # source://prism//lib/prism/dispatcher.rb#1184 def visit_statements_node(node); end # Dispatch enter and leave events for StringNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1183 + # source://prism//lib/prism/dispatcher.rb#1192 def visit_string_node(node); end # Dispatch enter and leave events for SuperNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1191 + # source://prism//lib/prism/dispatcher.rb#1200 def visit_super_node(node); end # Dispatch enter and leave events for SymbolNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1199 + # source://prism//lib/prism/dispatcher.rb#1208 def visit_symbol_node(node); end # Dispatch enter and leave events for TrueNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1207 + # source://prism//lib/prism/dispatcher.rb#1216 def visit_true_node(node); end # Dispatch enter and leave events for UndefNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1215 + # source://prism//lib/prism/dispatcher.rb#1224 def visit_undef_node(node); end # Dispatch enter and leave events for UnlessNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1223 + # source://prism//lib/prism/dispatcher.rb#1232 def visit_unless_node(node); end # Dispatch enter and leave events for UntilNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1231 + # source://prism//lib/prism/dispatcher.rb#1240 def visit_until_node(node); end # Dispatch enter and leave events for WhenNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1239 + # source://prism//lib/prism/dispatcher.rb#1248 def visit_when_node(node); end # Dispatch enter and leave events for WhileNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1247 + # source://prism//lib/prism/dispatcher.rb#1256 def visit_while_node(node); end # Dispatch enter and leave events for XStringNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1255 + # source://prism//lib/prism/dispatcher.rb#1264 def visit_x_string_node(node); end # Dispatch enter and leave events for YieldNode nodes and continue # walking the tree. # - # source://prism//lib/prism/dispatcher.rb#1263 + # source://prism//lib/prism/dispatcher.rb#1272 def visit_yield_node(node); end end -# source://prism//lib/prism/dispatcher.rb#1269 +# source://prism//lib/prism/dispatcher.rb#1278 class Prism::Dispatcher::DispatchOnce < ::Prism::Visitor # @return [DispatchOnce] a new instance of DispatchOnce # - # source://prism//lib/prism/dispatcher.rb#1272 + # source://prism//lib/prism/dispatcher.rb#1281 def initialize(listeners); end # Returns the value of attribute listeners. # - # source://prism//lib/prism/dispatcher.rb#1270 + # source://prism//lib/prism/dispatcher.rb#1279 def listeners; end # Dispatch enter and leave events for AliasGlobalVariableNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1277 + # source://prism//lib/prism/dispatcher.rb#1286 def visit_alias_global_variable_node(node); end # Dispatch enter and leave events for AliasMethodNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1283 + # source://prism//lib/prism/dispatcher.rb#1292 def visit_alias_method_node(node); end # Dispatch enter and leave events for AlternationPatternNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1289 + # source://prism//lib/prism/dispatcher.rb#1298 def visit_alternation_pattern_node(node); end # Dispatch enter and leave events for AndNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1295 + # source://prism//lib/prism/dispatcher.rb#1304 def visit_and_node(node); end # Dispatch enter and leave events for ArgumentsNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1301 + # source://prism//lib/prism/dispatcher.rb#1310 def visit_arguments_node(node); end # Dispatch enter and leave events for ArrayNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1307 + # source://prism//lib/prism/dispatcher.rb#1316 def visit_array_node(node); end # Dispatch enter and leave events for ArrayPatternNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1313 + # source://prism//lib/prism/dispatcher.rb#1322 def visit_array_pattern_node(node); end # Dispatch enter and leave events for AssocNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1319 + # source://prism//lib/prism/dispatcher.rb#1328 def visit_assoc_node(node); end # Dispatch enter and leave events for AssocSplatNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1325 + # source://prism//lib/prism/dispatcher.rb#1334 def visit_assoc_splat_node(node); end # Dispatch enter and leave events for BackReferenceReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1331 + # source://prism//lib/prism/dispatcher.rb#1340 def visit_back_reference_read_node(node); end # Dispatch enter and leave events for BeginNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1337 + # source://prism//lib/prism/dispatcher.rb#1346 def visit_begin_node(node); end # Dispatch enter and leave events for BlockArgumentNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1343 + # source://prism//lib/prism/dispatcher.rb#1352 def visit_block_argument_node(node); end # Dispatch enter and leave events for BlockLocalVariableNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1349 + # source://prism//lib/prism/dispatcher.rb#1358 def visit_block_local_variable_node(node); end # Dispatch enter and leave events for BlockNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1355 + # source://prism//lib/prism/dispatcher.rb#1364 def visit_block_node(node); end # Dispatch enter and leave events for BlockParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1361 + # source://prism//lib/prism/dispatcher.rb#1370 def visit_block_parameter_node(node); end # Dispatch enter and leave events for BlockParametersNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1367 + # source://prism//lib/prism/dispatcher.rb#1376 def visit_block_parameters_node(node); end # Dispatch enter and leave events for BreakNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1373 + # source://prism//lib/prism/dispatcher.rb#1382 def visit_break_node(node); end # Dispatch enter and leave events for CallAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1379 + # source://prism//lib/prism/dispatcher.rb#1388 def visit_call_and_write_node(node); end # Dispatch enter and leave events for CallNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1385 + # source://prism//lib/prism/dispatcher.rb#1394 def visit_call_node(node); end # Dispatch enter and leave events for CallOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1391 + # source://prism//lib/prism/dispatcher.rb#1400 def visit_call_operator_write_node(node); end # Dispatch enter and leave events for CallOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1397 + # source://prism//lib/prism/dispatcher.rb#1406 def visit_call_or_write_node(node); end # Dispatch enter and leave events for CallTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1403 + # source://prism//lib/prism/dispatcher.rb#1412 def visit_call_target_node(node); end # Dispatch enter and leave events for CapturePatternNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1409 + # source://prism//lib/prism/dispatcher.rb#1418 def visit_capture_pattern_node(node); end # Dispatch enter and leave events for CaseMatchNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1415 + # source://prism//lib/prism/dispatcher.rb#1424 def visit_case_match_node(node); end # Dispatch enter and leave events for CaseNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1421 + # source://prism//lib/prism/dispatcher.rb#1430 def visit_case_node(node); end # Dispatch enter and leave events for ClassNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1427 + # source://prism//lib/prism/dispatcher.rb#1436 def visit_class_node(node); end # Dispatch enter and leave events for ClassVariableAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1433 + # source://prism//lib/prism/dispatcher.rb#1442 def visit_class_variable_and_write_node(node); end # Dispatch enter and leave events for ClassVariableOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1439 + # source://prism//lib/prism/dispatcher.rb#1448 def visit_class_variable_operator_write_node(node); end # Dispatch enter and leave events for ClassVariableOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1445 + # source://prism//lib/prism/dispatcher.rb#1454 def visit_class_variable_or_write_node(node); end # Dispatch enter and leave events for ClassVariableReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1451 + # source://prism//lib/prism/dispatcher.rb#1460 def visit_class_variable_read_node(node); end # Dispatch enter and leave events for ClassVariableTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1457 + # source://prism//lib/prism/dispatcher.rb#1466 def visit_class_variable_target_node(node); end # Dispatch enter and leave events for ClassVariableWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1463 + # source://prism//lib/prism/dispatcher.rb#1472 def visit_class_variable_write_node(node); end # Dispatch enter and leave events for ConstantAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1469 + # source://prism//lib/prism/dispatcher.rb#1478 def visit_constant_and_write_node(node); end # Dispatch enter and leave events for ConstantOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1475 + # source://prism//lib/prism/dispatcher.rb#1484 def visit_constant_operator_write_node(node); end # Dispatch enter and leave events for ConstantOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1481 + # source://prism//lib/prism/dispatcher.rb#1490 def visit_constant_or_write_node(node); end # Dispatch enter and leave events for ConstantPathAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1487 + # source://prism//lib/prism/dispatcher.rb#1496 def visit_constant_path_and_write_node(node); end # Dispatch enter and leave events for ConstantPathNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1493 + # source://prism//lib/prism/dispatcher.rb#1502 def visit_constant_path_node(node); end # Dispatch enter and leave events for ConstantPathOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1499 + # source://prism//lib/prism/dispatcher.rb#1508 def visit_constant_path_operator_write_node(node); end # Dispatch enter and leave events for ConstantPathOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1505 + # source://prism//lib/prism/dispatcher.rb#1514 def visit_constant_path_or_write_node(node); end # Dispatch enter and leave events for ConstantPathTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1511 + # source://prism//lib/prism/dispatcher.rb#1520 def visit_constant_path_target_node(node); end # Dispatch enter and leave events for ConstantPathWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1517 + # source://prism//lib/prism/dispatcher.rb#1526 def visit_constant_path_write_node(node); end # Dispatch enter and leave events for ConstantReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1523 + # source://prism//lib/prism/dispatcher.rb#1532 def visit_constant_read_node(node); end # Dispatch enter and leave events for ConstantTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1529 + # source://prism//lib/prism/dispatcher.rb#1538 def visit_constant_target_node(node); end # Dispatch enter and leave events for ConstantWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1535 + # source://prism//lib/prism/dispatcher.rb#1544 def visit_constant_write_node(node); end # Dispatch enter and leave events for DefNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1541 + # source://prism//lib/prism/dispatcher.rb#1550 def visit_def_node(node); end # Dispatch enter and leave events for DefinedNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1547 + # source://prism//lib/prism/dispatcher.rb#1556 def visit_defined_node(node); end # Dispatch enter and leave events for ElseNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1553 + # source://prism//lib/prism/dispatcher.rb#1562 def visit_else_node(node); end # Dispatch enter and leave events for EmbeddedStatementsNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1559 + # source://prism//lib/prism/dispatcher.rb#1568 def visit_embedded_statements_node(node); end # Dispatch enter and leave events for EmbeddedVariableNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1565 + # source://prism//lib/prism/dispatcher.rb#1574 def visit_embedded_variable_node(node); end # Dispatch enter and leave events for EnsureNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1571 + # source://prism//lib/prism/dispatcher.rb#1580 def visit_ensure_node(node); end # Dispatch enter and leave events for FalseNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1577 + # source://prism//lib/prism/dispatcher.rb#1586 def visit_false_node(node); end # Dispatch enter and leave events for FindPatternNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1583 + # source://prism//lib/prism/dispatcher.rb#1592 def visit_find_pattern_node(node); end # Dispatch enter and leave events for FlipFlopNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1589 + # source://prism//lib/prism/dispatcher.rb#1598 def visit_flip_flop_node(node); end # Dispatch enter and leave events for FloatNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1595 + # source://prism//lib/prism/dispatcher.rb#1604 def visit_float_node(node); end # Dispatch enter and leave events for ForNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1601 + # source://prism//lib/prism/dispatcher.rb#1610 def visit_for_node(node); end # Dispatch enter and leave events for ForwardingArgumentsNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1607 + # source://prism//lib/prism/dispatcher.rb#1616 def visit_forwarding_arguments_node(node); end # Dispatch enter and leave events for ForwardingParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1613 + # source://prism//lib/prism/dispatcher.rb#1622 def visit_forwarding_parameter_node(node); end # Dispatch enter and leave events for ForwardingSuperNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1619 + # source://prism//lib/prism/dispatcher.rb#1628 def visit_forwarding_super_node(node); end # Dispatch enter and leave events for GlobalVariableAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1625 + # source://prism//lib/prism/dispatcher.rb#1634 def visit_global_variable_and_write_node(node); end # Dispatch enter and leave events for GlobalVariableOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1631 + # source://prism//lib/prism/dispatcher.rb#1640 def visit_global_variable_operator_write_node(node); end # Dispatch enter and leave events for GlobalVariableOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1637 + # source://prism//lib/prism/dispatcher.rb#1646 def visit_global_variable_or_write_node(node); end # Dispatch enter and leave events for GlobalVariableReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1643 + # source://prism//lib/prism/dispatcher.rb#1652 def visit_global_variable_read_node(node); end # Dispatch enter and leave events for GlobalVariableTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1649 + # source://prism//lib/prism/dispatcher.rb#1658 def visit_global_variable_target_node(node); end # Dispatch enter and leave events for GlobalVariableWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1655 + # source://prism//lib/prism/dispatcher.rb#1664 def visit_global_variable_write_node(node); end # Dispatch enter and leave events for HashNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1661 + # source://prism//lib/prism/dispatcher.rb#1670 def visit_hash_node(node); end # Dispatch enter and leave events for HashPatternNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1667 + # source://prism//lib/prism/dispatcher.rb#1676 def visit_hash_pattern_node(node); end # Dispatch enter and leave events for IfNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1673 + # source://prism//lib/prism/dispatcher.rb#1682 def visit_if_node(node); end # Dispatch enter and leave events for ImaginaryNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1679 + # source://prism//lib/prism/dispatcher.rb#1688 def visit_imaginary_node(node); end # Dispatch enter and leave events for ImplicitNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1685 + # source://prism//lib/prism/dispatcher.rb#1694 def visit_implicit_node(node); end # Dispatch enter and leave events for ImplicitRestNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1691 + # source://prism//lib/prism/dispatcher.rb#1700 def visit_implicit_rest_node(node); end # Dispatch enter and leave events for InNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1697 + # source://prism//lib/prism/dispatcher.rb#1706 def visit_in_node(node); end # Dispatch enter and leave events for IndexAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1703 + # source://prism//lib/prism/dispatcher.rb#1712 def visit_index_and_write_node(node); end # Dispatch enter and leave events for IndexOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1709 + # source://prism//lib/prism/dispatcher.rb#1718 def visit_index_operator_write_node(node); end # Dispatch enter and leave events for IndexOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1715 + # source://prism//lib/prism/dispatcher.rb#1724 def visit_index_or_write_node(node); end # Dispatch enter and leave events for IndexTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1721 + # source://prism//lib/prism/dispatcher.rb#1730 def visit_index_target_node(node); end # Dispatch enter and leave events for InstanceVariableAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1727 + # source://prism//lib/prism/dispatcher.rb#1736 def visit_instance_variable_and_write_node(node); end # Dispatch enter and leave events for InstanceVariableOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1733 + # source://prism//lib/prism/dispatcher.rb#1742 def visit_instance_variable_operator_write_node(node); end # Dispatch enter and leave events for InstanceVariableOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1739 + # source://prism//lib/prism/dispatcher.rb#1748 def visit_instance_variable_or_write_node(node); end # Dispatch enter and leave events for InstanceVariableReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1745 + # source://prism//lib/prism/dispatcher.rb#1754 def visit_instance_variable_read_node(node); end # Dispatch enter and leave events for InstanceVariableTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1751 + # source://prism//lib/prism/dispatcher.rb#1760 def visit_instance_variable_target_node(node); end # Dispatch enter and leave events for InstanceVariableWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1757 + # source://prism//lib/prism/dispatcher.rb#1766 def visit_instance_variable_write_node(node); end # Dispatch enter and leave events for IntegerNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1763 + # source://prism//lib/prism/dispatcher.rb#1772 def visit_integer_node(node); end # Dispatch enter and leave events for InterpolatedMatchLastLineNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1769 + # source://prism//lib/prism/dispatcher.rb#1778 def visit_interpolated_match_last_line_node(node); end # Dispatch enter and leave events for InterpolatedRegularExpressionNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1775 + # source://prism//lib/prism/dispatcher.rb#1784 def visit_interpolated_regular_expression_node(node); end # Dispatch enter and leave events for InterpolatedStringNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1781 + # source://prism//lib/prism/dispatcher.rb#1790 def visit_interpolated_string_node(node); end # Dispatch enter and leave events for InterpolatedSymbolNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1787 + # source://prism//lib/prism/dispatcher.rb#1796 def visit_interpolated_symbol_node(node); end # Dispatch enter and leave events for InterpolatedXStringNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1793 + # source://prism//lib/prism/dispatcher.rb#1802 def visit_interpolated_x_string_node(node); end + # Dispatch enter and leave events for ItLocalVariableReadNode nodes. + # + # source://prism//lib/prism/dispatcher.rb#1808 + def visit_it_local_variable_read_node(node); end + # Dispatch enter and leave events for ItParametersNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1799 + # source://prism//lib/prism/dispatcher.rb#1814 def visit_it_parameters_node(node); end # Dispatch enter and leave events for KeywordHashNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1805 + # source://prism//lib/prism/dispatcher.rb#1820 def visit_keyword_hash_node(node); end # Dispatch enter and leave events for KeywordRestParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1811 + # source://prism//lib/prism/dispatcher.rb#1826 def visit_keyword_rest_parameter_node(node); end # Dispatch enter and leave events for LambdaNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1817 + # source://prism//lib/prism/dispatcher.rb#1832 def visit_lambda_node(node); end # Dispatch enter and leave events for LocalVariableAndWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1823 + # source://prism//lib/prism/dispatcher.rb#1838 def visit_local_variable_and_write_node(node); end # Dispatch enter and leave events for LocalVariableOperatorWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1829 + # source://prism//lib/prism/dispatcher.rb#1844 def visit_local_variable_operator_write_node(node); end # Dispatch enter and leave events for LocalVariableOrWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1835 + # source://prism//lib/prism/dispatcher.rb#1850 def visit_local_variable_or_write_node(node); end # Dispatch enter and leave events for LocalVariableReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1841 + # source://prism//lib/prism/dispatcher.rb#1856 def visit_local_variable_read_node(node); end # Dispatch enter and leave events for LocalVariableTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1847 + # source://prism//lib/prism/dispatcher.rb#1862 def visit_local_variable_target_node(node); end # Dispatch enter and leave events for LocalVariableWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1853 + # source://prism//lib/prism/dispatcher.rb#1868 def visit_local_variable_write_node(node); end # Dispatch enter and leave events for MatchLastLineNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1859 + # source://prism//lib/prism/dispatcher.rb#1874 def visit_match_last_line_node(node); end # Dispatch enter and leave events for MatchPredicateNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1865 + # source://prism//lib/prism/dispatcher.rb#1880 def visit_match_predicate_node(node); end # Dispatch enter and leave events for MatchRequiredNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1871 + # source://prism//lib/prism/dispatcher.rb#1886 def visit_match_required_node(node); end # Dispatch enter and leave events for MatchWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1877 + # source://prism//lib/prism/dispatcher.rb#1892 def visit_match_write_node(node); end # Dispatch enter and leave events for MissingNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1883 + # source://prism//lib/prism/dispatcher.rb#1898 def visit_missing_node(node); end # Dispatch enter and leave events for ModuleNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1889 + # source://prism//lib/prism/dispatcher.rb#1904 def visit_module_node(node); end # Dispatch enter and leave events for MultiTargetNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1895 + # source://prism//lib/prism/dispatcher.rb#1910 def visit_multi_target_node(node); end # Dispatch enter and leave events for MultiWriteNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1901 + # source://prism//lib/prism/dispatcher.rb#1916 def visit_multi_write_node(node); end # Dispatch enter and leave events for NextNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1907 + # source://prism//lib/prism/dispatcher.rb#1922 def visit_next_node(node); end # Dispatch enter and leave events for NilNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1913 + # source://prism//lib/prism/dispatcher.rb#1928 def visit_nil_node(node); end # Dispatch enter and leave events for NoKeywordsParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1919 + # source://prism//lib/prism/dispatcher.rb#1934 def visit_no_keywords_parameter_node(node); end # Dispatch enter and leave events for NumberedParametersNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1925 + # source://prism//lib/prism/dispatcher.rb#1940 def visit_numbered_parameters_node(node); end # Dispatch enter and leave events for NumberedReferenceReadNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1931 + # source://prism//lib/prism/dispatcher.rb#1946 def visit_numbered_reference_read_node(node); end # Dispatch enter and leave events for OptionalKeywordParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1937 + # source://prism//lib/prism/dispatcher.rb#1952 def visit_optional_keyword_parameter_node(node); end # Dispatch enter and leave events for OptionalParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1943 + # source://prism//lib/prism/dispatcher.rb#1958 def visit_optional_parameter_node(node); end # Dispatch enter and leave events for OrNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1949 + # source://prism//lib/prism/dispatcher.rb#1964 def visit_or_node(node); end # Dispatch enter and leave events for ParametersNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1955 + # source://prism//lib/prism/dispatcher.rb#1970 def visit_parameters_node(node); end # Dispatch enter and leave events for ParenthesesNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1961 + # source://prism//lib/prism/dispatcher.rb#1976 def visit_parentheses_node(node); end # Dispatch enter and leave events for PinnedExpressionNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1967 + # source://prism//lib/prism/dispatcher.rb#1982 def visit_pinned_expression_node(node); end # Dispatch enter and leave events for PinnedVariableNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1973 + # source://prism//lib/prism/dispatcher.rb#1988 def visit_pinned_variable_node(node); end # Dispatch enter and leave events for PostExecutionNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1979 + # source://prism//lib/prism/dispatcher.rb#1994 def visit_post_execution_node(node); end # Dispatch enter and leave events for PreExecutionNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1985 + # source://prism//lib/prism/dispatcher.rb#2000 def visit_pre_execution_node(node); end # Dispatch enter and leave events for ProgramNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1991 + # source://prism//lib/prism/dispatcher.rb#2006 def visit_program_node(node); end # Dispatch enter and leave events for RangeNode nodes. # - # source://prism//lib/prism/dispatcher.rb#1997 + # source://prism//lib/prism/dispatcher.rb#2012 def visit_range_node(node); end # Dispatch enter and leave events for RationalNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2003 + # source://prism//lib/prism/dispatcher.rb#2018 def visit_rational_node(node); end # Dispatch enter and leave events for RedoNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2009 + # source://prism//lib/prism/dispatcher.rb#2024 def visit_redo_node(node); end # Dispatch enter and leave events for RegularExpressionNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2015 + # source://prism//lib/prism/dispatcher.rb#2030 def visit_regular_expression_node(node); end # Dispatch enter and leave events for RequiredKeywordParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2021 + # source://prism//lib/prism/dispatcher.rb#2036 def visit_required_keyword_parameter_node(node); end # Dispatch enter and leave events for RequiredParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2027 + # source://prism//lib/prism/dispatcher.rb#2042 def visit_required_parameter_node(node); end # Dispatch enter and leave events for RescueModifierNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2033 + # source://prism//lib/prism/dispatcher.rb#2048 def visit_rescue_modifier_node(node); end # Dispatch enter and leave events for RescueNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2039 + # source://prism//lib/prism/dispatcher.rb#2054 def visit_rescue_node(node); end # Dispatch enter and leave events for RestParameterNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2045 + # source://prism//lib/prism/dispatcher.rb#2060 def visit_rest_parameter_node(node); end # Dispatch enter and leave events for RetryNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2051 + # source://prism//lib/prism/dispatcher.rb#2066 def visit_retry_node(node); end # Dispatch enter and leave events for ReturnNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2057 + # source://prism//lib/prism/dispatcher.rb#2072 def visit_return_node(node); end # Dispatch enter and leave events for SelfNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2063 + # source://prism//lib/prism/dispatcher.rb#2078 def visit_self_node(node); end # Dispatch enter and leave events for ShareableConstantNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2069 + # source://prism//lib/prism/dispatcher.rb#2084 def visit_shareable_constant_node(node); end # Dispatch enter and leave events for SingletonClassNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2075 + # source://prism//lib/prism/dispatcher.rb#2090 def visit_singleton_class_node(node); end # Dispatch enter and leave events for SourceEncodingNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2081 + # source://prism//lib/prism/dispatcher.rb#2096 def visit_source_encoding_node(node); end # Dispatch enter and leave events for SourceFileNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2087 + # source://prism//lib/prism/dispatcher.rb#2102 def visit_source_file_node(node); end # Dispatch enter and leave events for SourceLineNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2093 + # source://prism//lib/prism/dispatcher.rb#2108 def visit_source_line_node(node); end # Dispatch enter and leave events for SplatNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2099 + # source://prism//lib/prism/dispatcher.rb#2114 def visit_splat_node(node); end # Dispatch enter and leave events for StatementsNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2105 + # source://prism//lib/prism/dispatcher.rb#2120 def visit_statements_node(node); end # Dispatch enter and leave events for StringNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2111 + # source://prism//lib/prism/dispatcher.rb#2126 def visit_string_node(node); end # Dispatch enter and leave events for SuperNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2117 + # source://prism//lib/prism/dispatcher.rb#2132 def visit_super_node(node); end # Dispatch enter and leave events for SymbolNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2123 + # source://prism//lib/prism/dispatcher.rb#2138 def visit_symbol_node(node); end # Dispatch enter and leave events for TrueNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2129 + # source://prism//lib/prism/dispatcher.rb#2144 def visit_true_node(node); end # Dispatch enter and leave events for UndefNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2135 + # source://prism//lib/prism/dispatcher.rb#2150 def visit_undef_node(node); end # Dispatch enter and leave events for UnlessNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2141 + # source://prism//lib/prism/dispatcher.rb#2156 def visit_unless_node(node); end # Dispatch enter and leave events for UntilNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2147 + # source://prism//lib/prism/dispatcher.rb#2162 def visit_until_node(node); end # Dispatch enter and leave events for WhenNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2153 + # source://prism//lib/prism/dispatcher.rb#2168 def visit_when_node(node); end # Dispatch enter and leave events for WhileNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2159 + # source://prism//lib/prism/dispatcher.rb#2174 def visit_while_node(node); end # Dispatch enter and leave events for XStringNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2165 + # source://prism//lib/prism/dispatcher.rb#2180 def visit_x_string_node(node); end # Dispatch enter and leave events for YieldNode nodes. # - # source://prism//lib/prism/dispatcher.rb#2171 + # source://prism//lib/prism/dispatcher.rb#2186 def visit_yield_node(node); end end @@ -11908,567 +13951,572 @@ class Prism::DotVisitor < ::Prism::Visitor # Visit a ConstantPathOperatorWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1307 + # source://prism//lib/prism/dot_visitor.rb#1309 def visit_constant_path_operator_write_node(node); end # Visit a ConstantPathOrWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1335 + # source://prism//lib/prism/dot_visitor.rb#1337 def visit_constant_path_or_write_node(node); end # Visit a ConstantPathTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#1360 + # source://prism//lib/prism/dot_visitor.rb#1362 def visit_constant_path_target_node(node); end # Visit a ConstantPathWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1387 + # source://prism//lib/prism/dot_visitor.rb#1391 def visit_constant_path_write_node(node); end # Visit a ConstantReadNode node. # - # source://prism//lib/prism/dot_visitor.rb#1412 + # source://prism//lib/prism/dot_visitor.rb#1416 def visit_constant_read_node(node); end # Visit a ConstantTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#1429 + # source://prism//lib/prism/dot_visitor.rb#1433 def visit_constant_target_node(node); end # Visit a ConstantWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1446 + # source://prism//lib/prism/dot_visitor.rb#1450 def visit_constant_write_node(node); end # Visit a DefNode node. # - # source://prism//lib/prism/dot_visitor.rb#1473 + # source://prism//lib/prism/dot_visitor.rb#1477 def visit_def_node(node); end # Visit a DefinedNode node. # - # source://prism//lib/prism/dot_visitor.rb#1542 + # source://prism//lib/prism/dot_visitor.rb#1546 def visit_defined_node(node); end # Visit a ElseNode node. # - # source://prism//lib/prism/dot_visitor.rb#1573 + # source://prism//lib/prism/dot_visitor.rb#1577 def visit_else_node(node); end # Visit a EmbeddedStatementsNode node. # - # source://prism//lib/prism/dot_visitor.rb#1601 + # source://prism//lib/prism/dot_visitor.rb#1605 def visit_embedded_statements_node(node); end # Visit a EmbeddedVariableNode node. # - # source://prism//lib/prism/dot_visitor.rb#1627 + # source://prism//lib/prism/dot_visitor.rb#1631 def visit_embedded_variable_node(node); end # Visit a EnsureNode node. # - # source://prism//lib/prism/dot_visitor.rb#1648 + # source://prism//lib/prism/dot_visitor.rb#1652 def visit_ensure_node(node); end # Visit a FalseNode node. # - # source://prism//lib/prism/dot_visitor.rb#1674 + # source://prism//lib/prism/dot_visitor.rb#1678 def visit_false_node(node); end # Visit a FindPatternNode node. # - # source://prism//lib/prism/dot_visitor.rb#1688 + # source://prism//lib/prism/dot_visitor.rb#1692 def visit_find_pattern_node(node); end # Visit a FlipFlopNode node. # - # source://prism//lib/prism/dot_visitor.rb#1739 + # source://prism//lib/prism/dot_visitor.rb#1743 def visit_flip_flop_node(node); end # Visit a FloatNode node. # - # source://prism//lib/prism/dot_visitor.rb#1771 + # source://prism//lib/prism/dot_visitor.rb#1775 def visit_float_node(node); end # Visit a ForNode node. # - # source://prism//lib/prism/dot_visitor.rb#1788 + # source://prism//lib/prism/dot_visitor.rb#1792 def visit_for_node(node); end # Visit a ForwardingArgumentsNode node. # - # source://prism//lib/prism/dot_visitor.rb#1830 + # source://prism//lib/prism/dot_visitor.rb#1834 def visit_forwarding_arguments_node(node); end # Visit a ForwardingParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#1844 + # source://prism//lib/prism/dot_visitor.rb#1848 def visit_forwarding_parameter_node(node); end # Visit a ForwardingSuperNode node. # - # source://prism//lib/prism/dot_visitor.rb#1858 + # source://prism//lib/prism/dot_visitor.rb#1862 def visit_forwarding_super_node(node); end # Visit a GlobalVariableAndWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1878 + # source://prism//lib/prism/dot_visitor.rb#1882 def visit_global_variable_and_write_node(node); end # Visit a GlobalVariableOperatorWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1905 + # source://prism//lib/prism/dot_visitor.rb#1909 def visit_global_variable_operator_write_node(node); end # Visit a GlobalVariableOrWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1935 + # source://prism//lib/prism/dot_visitor.rb#1939 def visit_global_variable_or_write_node(node); end # Visit a GlobalVariableReadNode node. # - # source://prism//lib/prism/dot_visitor.rb#1962 + # source://prism//lib/prism/dot_visitor.rb#1966 def visit_global_variable_read_node(node); end # Visit a GlobalVariableTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#1979 + # source://prism//lib/prism/dot_visitor.rb#1983 def visit_global_variable_target_node(node); end # Visit a GlobalVariableWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#1996 + # source://prism//lib/prism/dot_visitor.rb#2000 def visit_global_variable_write_node(node); end # Visit a HashNode node. # - # source://prism//lib/prism/dot_visitor.rb#2023 + # source://prism//lib/prism/dot_visitor.rb#2027 def visit_hash_node(node); end # Visit a HashPatternNode node. # - # source://prism//lib/prism/dot_visitor.rb#2056 + # source://prism//lib/prism/dot_visitor.rb#2060 def visit_hash_pattern_node(node); end # Visit a IfNode node. # - # source://prism//lib/prism/dot_visitor.rb#2105 + # source://prism//lib/prism/dot_visitor.rb#2109 def visit_if_node(node); end # Visit a ImaginaryNode node. # - # source://prism//lib/prism/dot_visitor.rb#2150 + # source://prism//lib/prism/dot_visitor.rb#2154 def visit_imaginary_node(node); end # Visit a ImplicitNode node. # - # source://prism//lib/prism/dot_visitor.rb#2168 + # source://prism//lib/prism/dot_visitor.rb#2172 def visit_implicit_node(node); end # Visit a ImplicitRestNode node. # - # source://prism//lib/prism/dot_visitor.rb#2186 + # source://prism//lib/prism/dot_visitor.rb#2190 def visit_implicit_rest_node(node); end # Visit a InNode node. # - # source://prism//lib/prism/dot_visitor.rb#2200 + # source://prism//lib/prism/dot_visitor.rb#2204 def visit_in_node(node); end # Visit a IndexAndWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2232 + # source://prism//lib/prism/dot_visitor.rb#2236 def visit_index_and_write_node(node); end # Visit a IndexOperatorWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2285 + # source://prism//lib/prism/dot_visitor.rb#2289 def visit_index_operator_write_node(node); end # Visit a IndexOrWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2341 + # source://prism//lib/prism/dot_visitor.rb#2345 def visit_index_or_write_node(node); end # Visit a IndexTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#2394 + # source://prism//lib/prism/dot_visitor.rb#2398 def visit_index_target_node(node); end # Visit a InstanceVariableAndWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2433 + # source://prism//lib/prism/dot_visitor.rb#2437 def visit_instance_variable_and_write_node(node); end # Visit a InstanceVariableOperatorWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2460 + # source://prism//lib/prism/dot_visitor.rb#2464 def visit_instance_variable_operator_write_node(node); end # Visit a InstanceVariableOrWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2490 + # source://prism//lib/prism/dot_visitor.rb#2494 def visit_instance_variable_or_write_node(node); end # Visit a InstanceVariableReadNode node. # - # source://prism//lib/prism/dot_visitor.rb#2517 + # source://prism//lib/prism/dot_visitor.rb#2521 def visit_instance_variable_read_node(node); end # Visit a InstanceVariableTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#2534 + # source://prism//lib/prism/dot_visitor.rb#2538 def visit_instance_variable_target_node(node); end # Visit a InstanceVariableWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2551 + # source://prism//lib/prism/dot_visitor.rb#2555 def visit_instance_variable_write_node(node); end # Visit a IntegerNode node. # - # source://prism//lib/prism/dot_visitor.rb#2578 + # source://prism//lib/prism/dot_visitor.rb#2582 def visit_integer_node(node); end # Visit a InterpolatedMatchLastLineNode node. # - # source://prism//lib/prism/dot_visitor.rb#2598 + # source://prism//lib/prism/dot_visitor.rb#2602 def visit_interpolated_match_last_line_node(node); end # Visit a InterpolatedRegularExpressionNode node. # - # source://prism//lib/prism/dot_visitor.rb#2634 + # source://prism//lib/prism/dot_visitor.rb#2638 def visit_interpolated_regular_expression_node(node); end # Visit a InterpolatedStringNode node. # - # source://prism//lib/prism/dot_visitor.rb#2670 + # source://prism//lib/prism/dot_visitor.rb#2674 def visit_interpolated_string_node(node); end # Visit a InterpolatedSymbolNode node. # - # source://prism//lib/prism/dot_visitor.rb#2710 + # source://prism//lib/prism/dot_visitor.rb#2714 def visit_interpolated_symbol_node(node); end # Visit a InterpolatedXStringNode node. # - # source://prism//lib/prism/dot_visitor.rb#2747 + # source://prism//lib/prism/dot_visitor.rb#2751 def visit_interpolated_x_string_node(node); end + # Visit a ItLocalVariableReadNode node. + # + # source://prism//lib/prism/dot_visitor.rb#2784 + def visit_it_local_variable_read_node(node); end + # Visit a ItParametersNode node. # - # source://prism//lib/prism/dot_visitor.rb#2780 + # source://prism//lib/prism/dot_visitor.rb#2798 def visit_it_parameters_node(node); end # Visit a KeywordHashNode node. # - # source://prism//lib/prism/dot_visitor.rb#2794 + # source://prism//lib/prism/dot_visitor.rb#2812 def visit_keyword_hash_node(node); end # Visit a KeywordRestParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#2824 + # source://prism//lib/prism/dot_visitor.rb#2842 def visit_keyword_rest_parameter_node(node); end # Visit a LambdaNode node. # - # source://prism//lib/prism/dot_visitor.rb#2852 + # source://prism//lib/prism/dot_visitor.rb#2870 def visit_lambda_node(node); end # Visit a LocalVariableAndWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2890 + # source://prism//lib/prism/dot_visitor.rb#2908 def visit_local_variable_and_write_node(node); end # Visit a LocalVariableOperatorWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2920 + # source://prism//lib/prism/dot_visitor.rb#2938 def visit_local_variable_operator_write_node(node); end # Visit a LocalVariableOrWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#2953 + # source://prism//lib/prism/dot_visitor.rb#2971 def visit_local_variable_or_write_node(node); end # Visit a LocalVariableReadNode node. # - # source://prism//lib/prism/dot_visitor.rb#2983 + # source://prism//lib/prism/dot_visitor.rb#3001 def visit_local_variable_read_node(node); end # Visit a LocalVariableTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#3003 + # source://prism//lib/prism/dot_visitor.rb#3021 def visit_local_variable_target_node(node); end # Visit a LocalVariableWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#3023 + # source://prism//lib/prism/dot_visitor.rb#3041 def visit_local_variable_write_node(node); end # Visit a MatchLastLineNode node. # - # source://prism//lib/prism/dot_visitor.rb#3053 + # source://prism//lib/prism/dot_visitor.rb#3071 def visit_match_last_line_node(node); end # Visit a MatchPredicateNode node. # - # source://prism//lib/prism/dot_visitor.rb#3082 + # source://prism//lib/prism/dot_visitor.rb#3100 def visit_match_predicate_node(node); end # Visit a MatchRequiredNode node. # - # source://prism//lib/prism/dot_visitor.rb#3107 + # source://prism//lib/prism/dot_visitor.rb#3125 def visit_match_required_node(node); end # Visit a MatchWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#3132 + # source://prism//lib/prism/dot_visitor.rb#3150 def visit_match_write_node(node); end # Visit a MissingNode node. # - # source://prism//lib/prism/dot_visitor.rb#3163 + # source://prism//lib/prism/dot_visitor.rb#3181 def visit_missing_node(node); end # Visit a ModuleNode node. # - # source://prism//lib/prism/dot_visitor.rb#3177 + # source://prism//lib/prism/dot_visitor.rb#3195 def visit_module_node(node); end # Visit a MultiTargetNode node. # - # source://prism//lib/prism/dot_visitor.rb#3213 + # source://prism//lib/prism/dot_visitor.rb#3231 def visit_multi_target_node(node); end # Visit a MultiWriteNode node. # - # source://prism//lib/prism/dot_visitor.rb#3269 + # source://prism//lib/prism/dot_visitor.rb#3287 def visit_multi_write_node(node); end # Visit a NextNode node. # - # source://prism//lib/prism/dot_visitor.rb#3332 + # source://prism//lib/prism/dot_visitor.rb#3350 def visit_next_node(node); end # Visit a NilNode node. # - # source://prism//lib/prism/dot_visitor.rb#3355 + # source://prism//lib/prism/dot_visitor.rb#3373 def visit_nil_node(node); end # Visit a NoKeywordsParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3369 + # source://prism//lib/prism/dot_visitor.rb#3387 def visit_no_keywords_parameter_node(node); end # Visit a NumberedParametersNode node. # - # source://prism//lib/prism/dot_visitor.rb#3389 + # source://prism//lib/prism/dot_visitor.rb#3407 def visit_numbered_parameters_node(node); end # Visit a NumberedReferenceReadNode node. # - # source://prism//lib/prism/dot_visitor.rb#3406 + # source://prism//lib/prism/dot_visitor.rb#3424 def visit_numbered_reference_read_node(node); end # Visit a OptionalKeywordParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3423 + # source://prism//lib/prism/dot_visitor.rb#3441 def visit_optional_keyword_parameter_node(node); end # Visit a OptionalParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3450 + # source://prism//lib/prism/dot_visitor.rb#3468 def visit_optional_parameter_node(node); end # Visit a OrNode node. # - # source://prism//lib/prism/dot_visitor.rb#3480 + # source://prism//lib/prism/dot_visitor.rb#3498 def visit_or_node(node); end # Visit a ParametersNode node. # - # source://prism//lib/prism/dot_visitor.rb#3505 + # source://prism//lib/prism/dot_visitor.rb#3523 def visit_parameters_node(node); end # Visit a ParenthesesNode node. # - # source://prism//lib/prism/dot_visitor.rb#3589 + # source://prism//lib/prism/dot_visitor.rb#3607 def visit_parentheses_node(node); end # Visit a PinnedExpressionNode node. # - # source://prism//lib/prism/dot_visitor.rb#3615 + # source://prism//lib/prism/dot_visitor.rb#3636 def visit_pinned_expression_node(node); end # Visit a PinnedVariableNode node. # - # source://prism//lib/prism/dot_visitor.rb#3642 + # source://prism//lib/prism/dot_visitor.rb#3663 def visit_pinned_variable_node(node); end # Visit a PostExecutionNode node. # - # source://prism//lib/prism/dot_visitor.rb#3663 + # source://prism//lib/prism/dot_visitor.rb#3684 def visit_post_execution_node(node); end # Visit a PreExecutionNode node. # - # source://prism//lib/prism/dot_visitor.rb#3692 + # source://prism//lib/prism/dot_visitor.rb#3713 def visit_pre_execution_node(node); end # Visit a ProgramNode node. # - # source://prism//lib/prism/dot_visitor.rb#3721 + # source://prism//lib/prism/dot_visitor.rb#3742 def visit_program_node(node); end # Visit a RangeNode node. # - # source://prism//lib/prism/dot_visitor.rb#3742 + # source://prism//lib/prism/dot_visitor.rb#3763 def visit_range_node(node); end # Visit a RationalNode node. # - # source://prism//lib/prism/dot_visitor.rb#3774 + # source://prism//lib/prism/dot_visitor.rb#3795 def visit_rational_node(node); end # Visit a RedoNode node. # - # source://prism//lib/prism/dot_visitor.rb#3792 + # source://prism//lib/prism/dot_visitor.rb#3818 def visit_redo_node(node); end # Visit a RegularExpressionNode node. # - # source://prism//lib/prism/dot_visitor.rb#3806 + # source://prism//lib/prism/dot_visitor.rb#3832 def visit_regular_expression_node(node); end # Visit a RequiredKeywordParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3835 + # source://prism//lib/prism/dot_visitor.rb#3861 def visit_required_keyword_parameter_node(node); end # Visit a RequiredParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3858 + # source://prism//lib/prism/dot_visitor.rb#3884 def visit_required_parameter_node(node); end # Visit a RescueModifierNode node. # - # source://prism//lib/prism/dot_visitor.rb#3878 + # source://prism//lib/prism/dot_visitor.rb#3904 def visit_rescue_modifier_node(node); end # Visit a RescueNode node. # - # source://prism//lib/prism/dot_visitor.rb#3903 + # source://prism//lib/prism/dot_visitor.rb#3929 def visit_rescue_node(node); end # Visit a RestParameterNode node. # - # source://prism//lib/prism/dot_visitor.rb#3956 + # source://prism//lib/prism/dot_visitor.rb#3987 def visit_rest_parameter_node(node); end # Visit a RetryNode node. # - # source://prism//lib/prism/dot_visitor.rb#3984 + # source://prism//lib/prism/dot_visitor.rb#4015 def visit_retry_node(node); end # Visit a ReturnNode node. # - # source://prism//lib/prism/dot_visitor.rb#3998 + # source://prism//lib/prism/dot_visitor.rb#4029 def visit_return_node(node); end # Visit a SelfNode node. # - # source://prism//lib/prism/dot_visitor.rb#4021 + # source://prism//lib/prism/dot_visitor.rb#4052 def visit_self_node(node); end # Visit a ShareableConstantNode node. # - # source://prism//lib/prism/dot_visitor.rb#4035 + # source://prism//lib/prism/dot_visitor.rb#4066 def visit_shareable_constant_node(node); end # Visit a SingletonClassNode node. # - # source://prism//lib/prism/dot_visitor.rb#4056 + # source://prism//lib/prism/dot_visitor.rb#4087 def visit_singleton_class_node(node); end # Visit a SourceEncodingNode node. # - # source://prism//lib/prism/dot_visitor.rb#4092 + # source://prism//lib/prism/dot_visitor.rb#4123 def visit_source_encoding_node(node); end # Visit a SourceFileNode node. # - # source://prism//lib/prism/dot_visitor.rb#4106 + # source://prism//lib/prism/dot_visitor.rb#4137 def visit_source_file_node(node); end # Visit a SourceLineNode node. # - # source://prism//lib/prism/dot_visitor.rb#4126 + # source://prism//lib/prism/dot_visitor.rb#4157 def visit_source_line_node(node); end # Visit a SplatNode node. # - # source://prism//lib/prism/dot_visitor.rb#4140 + # source://prism//lib/prism/dot_visitor.rb#4171 def visit_splat_node(node); end # Visit a StatementsNode node. # - # source://prism//lib/prism/dot_visitor.rb#4163 + # source://prism//lib/prism/dot_visitor.rb#4194 def visit_statements_node(node); end # Visit a StringNode node. # - # source://prism//lib/prism/dot_visitor.rb#4190 + # source://prism//lib/prism/dot_visitor.rb#4221 def visit_string_node(node); end # Visit a SuperNode node. # - # source://prism//lib/prism/dot_visitor.rb#4223 + # source://prism//lib/prism/dot_visitor.rb#4254 def visit_super_node(node); end # Visit a SymbolNode node. # - # source://prism//lib/prism/dot_visitor.rb#4262 + # source://prism//lib/prism/dot_visitor.rb#4293 def visit_symbol_node(node); end # Visit a TrueNode node. # - # source://prism//lib/prism/dot_visitor.rb#4297 + # source://prism//lib/prism/dot_visitor.rb#4328 def visit_true_node(node); end # Visit a UndefNode node. # - # source://prism//lib/prism/dot_visitor.rb#4311 + # source://prism//lib/prism/dot_visitor.rb#4342 def visit_undef_node(node); end # Visit a UnlessNode node. # - # source://prism//lib/prism/dot_visitor.rb#4341 + # source://prism//lib/prism/dot_visitor.rb#4372 def visit_unless_node(node); end # Visit a UntilNode node. # - # source://prism//lib/prism/dot_visitor.rb#4384 + # source://prism//lib/prism/dot_visitor.rb#4415 def visit_until_node(node); end # Visit a WhenNode node. # - # source://prism//lib/prism/dot_visitor.rb#4419 + # source://prism//lib/prism/dot_visitor.rb#4455 def visit_when_node(node); end # Visit a WhileNode node. # - # source://prism//lib/prism/dot_visitor.rb#4460 + # source://prism//lib/prism/dot_visitor.rb#4496 def visit_while_node(node); end # Visit a XStringNode node. # - # source://prism//lib/prism/dot_visitor.rb#4495 + # source://prism//lib/prism/dot_visitor.rb#4536 def visit_x_string_node(node); end # Visit a YieldNode node. # - # source://prism//lib/prism/dot_visitor.rb#4524 + # source://prism//lib/prism/dot_visitor.rb#4565 def visit_yield_node(node); end private @@ -12476,95 +14524,101 @@ class Prism::DotVisitor < ::Prism::Visitor # Inspect a node that has arguments_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4570 + # source://prism//lib/prism/dot_visitor.rb#4611 def arguments_node_flags_inspect(node); end # Inspect a node that has array_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4578 + # source://prism//lib/prism/dot_visitor.rb#4623 def array_node_flags_inspect(node); end # Inspect a node that has call_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4586 + # source://prism//lib/prism/dot_visitor.rb#4631 def call_node_flags_inspect(node); end # Inspect a node that has encoding_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4597 + # source://prism//lib/prism/dot_visitor.rb#4642 def encoding_flags_inspect(node); end # Inspect a node that has integer_base_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4606 + # source://prism//lib/prism/dot_visitor.rb#4651 def integer_base_flags_inspect(node); end # Inspect a node that has interpolated_string_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4617 + # source://prism//lib/prism/dot_visitor.rb#4662 def interpolated_string_node_flags_inspect(node); end # Inspect a node that has keyword_hash_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4626 + # source://prism//lib/prism/dot_visitor.rb#4671 def keyword_hash_node_flags_inspect(node); end # Inspect a location to display the start and end line and column numbers. # - # source://prism//lib/prism/dot_visitor.rb#4564 + # source://prism//lib/prism/dot_visitor.rb#4605 def location_inspect(location); end # Inspect a node that has loop_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4634 + # source://prism//lib/prism/dot_visitor.rb#4679 def loop_flags_inspect(node); end # Generate a unique node ID for a node throughout the digraph. # - # source://prism//lib/prism/dot_visitor.rb#4559 + # source://prism//lib/prism/dot_visitor.rb#4600 def node_id(node); end # Inspect a node that has parameter_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4642 + # source://prism//lib/prism/dot_visitor.rb#4687 def parameter_flags_inspect(node); end + # Inspect a node that has parentheses_node_flags flags to display the flags as a + # comma-separated list. + # + # source://prism//lib/prism/dot_visitor.rb#4695 + def parentheses_node_flags_inspect(node); end + # Inspect a node that has range_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4650 + # source://prism//lib/prism/dot_visitor.rb#4703 def range_flags_inspect(node); end # Inspect a node that has regular_expression_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4658 + # source://prism//lib/prism/dot_visitor.rb#4711 def regular_expression_flags_inspect(node); end # Inspect a node that has shareable_constant_node_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4676 + # source://prism//lib/prism/dot_visitor.rb#4729 def shareable_constant_node_flags_inspect(node); end # Inspect a node that has string_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4686 + # source://prism//lib/prism/dot_visitor.rb#4739 def string_flags_inspect(node); end # Inspect a node that has symbol_flags flags to display the flags as a # comma-separated list. # - # source://prism//lib/prism/dot_visitor.rb#4697 + # source://prism//lib/prism/dot_visitor.rb#4750 def symbol_flags_inspect(node); end end @@ -12658,147 +14712,145 @@ end # if a then b else c end # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#6593 +# source://prism//lib/prism/node.rb#6294 class Prism::ElseNode < ::Prism::Node - # def initialize: (Location else_keyword_loc, StatementsNode? statements, Location? end_keyword_loc, Location location) -> void + # Initialize a new ElseNode node. # # @return [ElseNode] a new instance of ElseNode # - # source://prism//lib/prism/node.rb#6595 + # source://prism//lib/prism/node.rb#6296 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, else_keyword_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).void end - def initialize(source, else_keyword_loc, statements, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6716 + # source://prism//lib/prism/node.rb#6403 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6605 + # source://prism//lib/prism/node.rb#6307 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6610 + # source://prism//lib/prism/node.rb#6312 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6622 + # source://prism//lib/prism/node.rb#6324 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6615 + # source://prism//lib/prism/node.rb#6317 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?, ?location: Location) -> ElseNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode # - # source://prism//lib/prism/node.rb#6627 + # source://prism//lib/prism/node.rb#6329 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, else_keyword_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + end_keyword_loc: T.nilable(Prism::Location) ).returns(Prism::ElseNode) end - def copy(else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6610 + # source://prism//lib/prism/node.rb#6312 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { else_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, else_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location? } # - # source://prism//lib/prism/node.rb#6635 + # source://prism//lib/prism/node.rb#6337 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def else_keyword: () -> String # - # source://prism//lib/prism/node.rb#6663 + # source://prism//lib/prism/node.rb#6377 sig { returns(String) } def else_keyword; end # attr_reader else_keyword_loc: Location # - # source://prism//lib/prism/node.rb#6640 + # source://prism//lib/prism/node.rb#6342 sig { returns(Prism::Location) } def else_keyword_loc; end # def end_keyword: () -> String? # - # source://prism//lib/prism/node.rb#6668 + # source://prism//lib/prism/node.rb#6382 sig { returns(T.nilable(String)) } def end_keyword; end # attr_reader end_keyword_loc: Location? # - # source://prism//lib/prism/node.rb#6650 + # source://prism//lib/prism/node.rb#6358 sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#6387 + sig { override.returns(String) } + def inspect; end + + # Save the else_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#6673 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6350 + def save_else_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6372 + def save_end_keyword_loc(repository); end # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#6647 + # source://prism//lib/prism/node.rb#6355 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#6700 + # source://prism//lib/prism/node.rb#6392 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#6710 + # source://prism//lib/prism/node.rb#6397 def type; end end end @@ -12806,11 +14858,11 @@ end # EmbDocComment objects correspond to comments that are surrounded by =begin # and =end. # -# source://prism//lib/prism/parse_result.rb#325 +# source://prism//lib/prism/parse_result.rb#561 class Prism::EmbDocComment < ::Prism::Comment # Returns a string representation of this comment. # - # source://prism//lib/prism/parse_result.rb#332 + # source://prism//lib/prism/parse_result.rb#568 sig { returns(String) } def inspect; end @@ -12818,7 +14870,7 @@ class Prism::EmbDocComment < ::Prism::Comment # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#327 + # source://prism//lib/prism/parse_result.rb#563 sig { override.returns(T::Boolean) } def trailing?; end end @@ -12828,147 +14880,145 @@ end # "foo #{bar}" # ^^^^^^ # -# source://prism//lib/prism/node.rb#6728 +# source://prism//lib/prism/node.rb#6415 class Prism::EmbeddedStatementsNode < ::Prism::Node - # def initialize: (Location opening_loc, StatementsNode? statements, Location closing_loc, Location location) -> void + # Initialize a new EmbeddedStatementsNode node. # # @return [EmbeddedStatementsNode] a new instance of EmbeddedStatementsNode # - # source://prism//lib/prism/node.rb#6730 + # source://prism//lib/prism/node.rb#6417 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).void end - def initialize(source, opening_loc, statements, closing_loc, location); end + def initialize(source, node_id, location, flags, opening_loc, statements, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6845 + # source://prism//lib/prism/node.rb#6518 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6740 + # source://prism//lib/prism/node.rb#6428 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6745 + # source://prism//lib/prism/node.rb#6433 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#6797 + # source://prism//lib/prism/node.rb#6497 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#6785 + # source://prism//lib/prism/node.rb#6479 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6757 + # source://prism//lib/prism/node.rb#6445 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6750 + # source://prism//lib/prism/node.rb#6438 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location, ?location: Location) -> EmbeddedStatementsNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode # - # source://prism//lib/prism/node.rb#6762 + # source://prism//lib/prism/node.rb#6450 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).returns(Prism::EmbeddedStatementsNode) end - def copy(opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6745 + # source://prism//lib/prism/node.rb#6433 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { opening_loc: Location, statements: StatementsNode?, closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, statements: StatementsNode?, closing_loc: Location } # - # source://prism//lib/prism/node.rb#6770 + # source://prism//lib/prism/node.rb#6458 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#6802 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6502 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#6792 + # source://prism//lib/prism/node.rb#6492 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#6775 + # source://prism//lib/prism/node.rb#6463 sig { returns(Prism::Location) } def opening_loc; end + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6487 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6471 + def save_opening_loc(repository); end + # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#6782 + # source://prism//lib/prism/node.rb#6476 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#6829 + # source://prism//lib/prism/node.rb#6507 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#6839 + # source://prism//lib/prism/node.rb#6512 def type; end end end @@ -12978,150 +15028,144 @@ end # "foo #@bar" # ^^^^^ # -# source://prism//lib/prism/node.rb#6857 +# source://prism//lib/prism/node.rb#6530 class Prism::EmbeddedVariableNode < ::Prism::Node - # def initialize: (Location operator_loc, Prism::node variable, Location location) -> void + # Initialize a new EmbeddedVariableNode node. # # @return [EmbeddedVariableNode] a new instance of EmbeddedVariableNode # - # source://prism//lib/prism/node.rb#6859 + # source://prism//lib/prism/node.rb#6532 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, operator_loc: Prism::Location, - variable: Prism::Node, - location: Prism::Location + variable: T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode) ).void end - def initialize(source, operator_loc, variable, location); end + def initialize(source, node_id, location, flags, operator_loc, variable); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#6954 + # source://prism//lib/prism/node.rb#6612 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6868 + # source://prism//lib/prism/node.rb#6542 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6873 + # source://prism//lib/prism/node.rb#6547 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6883 + # source://prism//lib/prism/node.rb#6557 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6878 + # source://prism//lib/prism/node.rb#6552 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?operator_loc: Location, ?variable: Prism::node, ?location: Location) -> EmbeddedVariableNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) -> EmbeddedVariableNode # - # source://prism//lib/prism/node.rb#6888 + # source://prism//lib/prism/node.rb#6562 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, operator_loc: Prism::Location, - variable: Prism::Node, - location: Prism::Location + variable: T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode) ).returns(Prism::EmbeddedVariableNode) end - def copy(operator_loc: T.unsafe(nil), variable: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), variable: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6873 + # source://prism//lib/prism/node.rb#6547 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { operator_loc: Location, variable: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode } # - # source://prism//lib/prism/node.rb#6896 + # source://prism//lib/prism/node.rb#6570 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#6916 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6596 + sig { override.returns(String) } + def inspect; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#6911 + # source://prism//lib/prism/node.rb#6591 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#6901 + # source://prism//lib/prism/node.rb#6575 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#6583 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#6938 + # source://prism//lib/prism/node.rb#6601 sig { override.returns(Symbol) } def type; end - # attr_reader variable: Prism::node + # attr_reader variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode # - # source://prism//lib/prism/node.rb#6908 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#6588 + sig do + returns(T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)) + end def variable; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#6948 + # source://prism//lib/prism/node.rb#6606 def type; end end end # Flags for nodes that have unescaped content. # -# source://prism//lib/prism/node.rb#20364 +# source://prism//lib/prism/node.rb#18498 module Prism::EncodingFlags; end # internal bytes forced the encoding to binary # -# source://prism//lib/prism/node.rb#20369 +# source://prism//lib/prism/node.rb#18503 Prism::EncodingFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) # internal bytes forced the encoding to UTF-8 # -# source://prism//lib/prism/node.rb#20366 +# source://prism//lib/prism/node.rb#18500 Prism::EncodingFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) # Represents an `ensure` clause in a `begin` statement. @@ -13133,147 +15177,145 @@ Prism::EncodingFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) # bar # end # -# source://prism//lib/prism/node.rb#6969 +# source://prism//lib/prism/node.rb#6627 class Prism::EnsureNode < ::Prism::Node - # def initialize: (Location ensure_keyword_loc, StatementsNode? statements, Location end_keyword_loc, Location location) -> void + # Initialize a new EnsureNode node. # # @return [EnsureNode] a new instance of EnsureNode # - # source://prism//lib/prism/node.rb#6971 + # source://prism//lib/prism/node.rb#6629 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, ensure_keyword_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).void end - def initialize(source, ensure_keyword_loc, statements, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7086 + # source://prism//lib/prism/node.rb#6730 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#6981 + # source://prism//lib/prism/node.rb#6640 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6986 + # source://prism//lib/prism/node.rb#6645 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#6998 + # source://prism//lib/prism/node.rb#6657 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#6991 + # source://prism//lib/prism/node.rb#6650 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location, ?location: Location) -> EnsureNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode # - # source://prism//lib/prism/node.rb#7003 + # source://prism//lib/prism/node.rb#6662 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, ensure_keyword_loc: Prism::Location, statements: T.nilable(Prism::StatementsNode), - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).returns(Prism::EnsureNode) end - def copy(ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#6986 + # source://prism//lib/prism/node.rb#6645 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { ensure_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, ensure_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location } # - # source://prism//lib/prism/node.rb#7011 + # source://prism//lib/prism/node.rb#6670 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # - # source://prism//lib/prism/node.rb#7038 + # source://prism//lib/prism/node.rb#6709 sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # - # source://prism//lib/prism/node.rb#7026 + # source://prism//lib/prism/node.rb#6691 sig { returns(Prism::Location) } def end_keyword_loc; end # def ensure_keyword: () -> String # - # source://prism//lib/prism/node.rb#7033 + # source://prism//lib/prism/node.rb#6704 sig { returns(String) } def ensure_keyword; end # attr_reader ensure_keyword_loc: Location # - # source://prism//lib/prism/node.rb#7016 + # source://prism//lib/prism/node.rb#6675 sig { returns(Prism::Location) } def ensure_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#6714 + sig { override.returns(String) } + def inspect; end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#6699 + def save_end_keyword_loc(repository); end + + # Save the ensure_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#7043 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6683 + def save_ensure_keyword_loc(repository); end # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#7023 + # source://prism//lib/prism/node.rb#6688 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7070 + # source://prism//lib/prism/node.rb#6719 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7080 + # source://prism//lib/prism/node.rb#6724 def type; end end end @@ -13283,102 +15325,84 @@ end # false # ^^^^^ # -# source://prism//lib/prism/node.rb#7098 +# source://prism//lib/prism/node.rb#6742 class Prism::FalseNode < ::Prism::Node - # def initialize: (Location location) -> void + # Initialize a new FalseNode node. # # @return [FalseNode] a new instance of FalseNode # - # source://prism//lib/prism/node.rb#7100 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#6744 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7175 + # source://prism//lib/prism/node.rb#6801 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7107 + # source://prism//lib/prism/node.rb#6752 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7112 + # source://prism//lib/prism/node.rb#6757 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7122 + # source://prism//lib/prism/node.rb#6767 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7117 + # source://prism//lib/prism/node.rb#6762 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> FalseNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> FalseNode # - # source://prism//lib/prism/node.rb#7127 - sig { params(location: Prism::Location).returns(Prism::FalseNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6772 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::FalseNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7112 + # source://prism//lib/prism/node.rb#6757 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#7135 + # source://prism//lib/prism/node.rb#6780 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7140 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6785 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7159 + # source://prism//lib/prism/node.rb#6790 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#7169 + # source://prism//lib/prism/node.rb#6795 def type; end end end @@ -13394,171 +15418,169 @@ end # foo in Foo(*bar, baz, *qux) # ^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#7190 +# source://prism//lib/prism/node.rb#6816 class Prism::FindPatternNode < ::Prism::Node - # def initialize: (Prism::node? constant, Prism::node left, Array[Prism::node] requireds, Prism::node right, Location? opening_loc, Location? closing_loc, Location location) -> void + # Initialize a new FindPatternNode node. # # @return [FindPatternNode] a new instance of FindPatternNode # - # source://prism//lib/prism/node.rb#7192 + # source://prism//lib/prism/node.rb#6818 sig do params( source: Prism::Source, - constant: T.nilable(Prism::Node), - left: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + left: Prism::SplatNode, requireds: T::Array[Prism::Node], - right: Prism::Node, + right: T.any(Prism::SplatNode, Prism::MissingNode), opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, constant, left, requireds, right, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7339 + # source://prism//lib/prism/node.rb#6946 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7205 + # source://prism//lib/prism/node.rb#6832 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7210 + # source://prism//lib/prism/node.rb#6837 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#7286 + # source://prism//lib/prism/node.rb#6925 sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # - # source://prism//lib/prism/node.rb#7268 + # source://prism//lib/prism/node.rb#6901 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7225 + # source://prism//lib/prism/node.rb#6852 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7215 + # source://prism//lib/prism/node.rb#6842 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader constant: Prism::node? + # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # - # source://prism//lib/prism/node.rb#7243 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#6870 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end - # def copy: (?constant: Prism::node?, ?left: Prism::node, ?requireds: Array[Prism::node], ?right: Prism::node, ?opening_loc: Location?, ?closing_loc: Location?, ?location: Location) -> FindPatternNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode | MissingNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode # - # source://prism//lib/prism/node.rb#7230 + # source://prism//lib/prism/node.rb#6857 sig do params( - constant: T.nilable(Prism::Node), - left: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + left: Prism::SplatNode, requireds: T::Array[Prism::Node], - right: Prism::Node, + right: T.any(Prism::SplatNode, Prism::MissingNode), opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).returns(Prism::FindPatternNode) end - def copy(constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7210 + # source://prism//lib/prism/node.rb#6837 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { constant: Prism::node?, left: Prism::node, requireds: Array[Prism::node], right: Prism::node, opening_loc: Location?, closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, left: SplatNode, requireds: Array[Prism::node], right: SplatNode | MissingNode, opening_loc: Location?, closing_loc: Location? } # - # source://prism//lib/prism/node.rb#7238 + # source://prism//lib/prism/node.rb#6865 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7291 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#6930 + sig { override.returns(String) } + def inspect; end - # attr_reader left: Prism::node + # attr_reader left: SplatNode # - # source://prism//lib/prism/node.rb#7246 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#6873 + sig { returns(Prism::SplatNode) } def left; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#7281 + # source://prism//lib/prism/node.rb#6920 sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # - # source://prism//lib/prism/node.rb#7255 + # source://prism//lib/prism/node.rb#6882 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader requireds: Array[Prism::node] # - # source://prism//lib/prism/node.rb#7249 + # source://prism//lib/prism/node.rb#6876 sig { returns(T::Array[Prism::Node]) } def requireds; end - # attr_reader right: Prism::node + # attr_reader right: SplatNode | MissingNode # - # source://prism//lib/prism/node.rb#7252 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#6879 + sig { returns(T.any(Prism::SplatNode, Prism::MissingNode)) } def right; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#6915 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#6896 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7323 + # source://prism//lib/prism/node.rb#6935 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#7333 + # source://prism//lib/prism/node.rb#6940 def type; end end end @@ -13568,79 +15590,81 @@ end # baz if foo .. bar # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#7355 +# source://prism//lib/prism/node.rb#6962 class Prism::FlipFlopNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? left, Prism::node? right, Location operator_loc, Location location) -> void + # Initialize a new FlipFlopNode node. # # @return [FlipFlopNode] a new instance of FlipFlopNode # - # source://prism//lib/prism/node.rb#7357 + # source://prism//lib/prism/node.rb#6964 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, left: T.nilable(Prism::Node), right: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, flags, left, right, operator_loc, location); end + def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7481 + # source://prism//lib/prism/node.rb#7056 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7368 + # source://prism//lib/prism/node.rb#6975 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7373 + # source://prism//lib/prism/node.rb#6980 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7386 + # source://prism//lib/prism/node.rb#6993 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7378 + # source://prism//lib/prism/node.rb#6985 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location, ?location: Location) -> FlipFlopNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode # - # source://prism//lib/prism/node.rb#7391 + # source://prism//lib/prism/node.rb#6998 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, left: T.nilable(Prism::Node), right: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::FlipFlopNode) end - def copy(flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7373 + # source://prism//lib/prism/node.rb#6980 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, left: Prism::node?, right: Prism::node?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node?, right: Prism::node?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#7399 + # source://prism//lib/prism/node.rb#7006 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -13648,79 +15672,59 @@ class Prism::FlipFlopNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#7421 + # source://prism//lib/prism/node.rb#7011 sig { returns(T::Boolean) } def exclude_end?; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7431 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7040 + sig { override.returns(String) } + def inspect; end # attr_reader left: Prism::node? # - # source://prism//lib/prism/node.rb#7408 + # source://prism//lib/prism/node.rb#7016 sig { returns(T.nilable(Prism::Node)) } def left; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#7426 + # source://prism//lib/prism/node.rb#7035 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#7414 + # source://prism//lib/prism/node.rb#7022 sig { returns(Prism::Location) } def operator_loc; end # attr_reader right: Prism::node? # - # source://prism//lib/prism/node.rb#7411 + # source://prism//lib/prism/node.rb#7019 sig { returns(T.nilable(Prism::Node)) } def right; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#7030 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7465 + # source://prism//lib/prism/node.rb#7045 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#7404 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7475 + # source://prism//lib/prism/node.rb#7050 def type; end end end @@ -13730,108 +15734,90 @@ end # 1.0 # ^^^ # -# source://prism//lib/prism/node.rb#7494 +# source://prism//lib/prism/node.rb#7069 class Prism::FloatNode < ::Prism::Node - # def initialize: (Float value, Location location) -> void + # Initialize a new FloatNode node. # # @return [FloatNode] a new instance of FloatNode # - # source://prism//lib/prism/node.rb#7496 - sig { params(source: Prism::Source, value: Float, location: Prism::Location).void } - def initialize(source, value, location); end + # source://prism//lib/prism/node.rb#7071 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, value: Float).void } + def initialize(source, node_id, location, flags, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7576 + # source://prism//lib/prism/node.rb#7132 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7504 + # source://prism//lib/prism/node.rb#7080 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7509 + # source://prism//lib/prism/node.rb#7085 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7519 + # source://prism//lib/prism/node.rb#7095 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7514 + # source://prism//lib/prism/node.rb#7090 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Float, ?location: Location) -> FloatNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode # - # source://prism//lib/prism/node.rb#7524 - sig { params(value: Float, location: Prism::Location).returns(Prism::FloatNode) } - def copy(value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7100 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer, value: Float).returns(Prism::FloatNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7509 + # source://prism//lib/prism/node.rb#7085 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Float, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Float } # - # source://prism//lib/prism/node.rb#7532 + # source://prism//lib/prism/node.rb#7108 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7540 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7116 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7560 + # source://prism//lib/prism/node.rb#7121 sig { override.returns(Symbol) } def type; end # The value of the floating point number as a Float. # - # source://prism//lib/prism/node.rb#7537 + # source://prism//lib/prism/node.rb#7113 sig { returns(Float) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#7570 + # source://prism//lib/prism/node.rb#7126 def type; end end end @@ -13841,115 +15827,128 @@ end # for i in a end # ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#7586 +# source://prism//lib/prism/node.rb#7142 class Prism::ForNode < ::Prism::Node - # def initialize: (Prism::node index, Prism::node collection, StatementsNode? statements, Location for_keyword_loc, Location in_keyword_loc, Location? do_keyword_loc, Location end_keyword_loc, Location location) -> void + # Initialize a new ForNode node. # # @return [ForNode] a new instance of ForNode # - # source://prism//lib/prism/node.rb#7588 + # source://prism//lib/prism/node.rb#7144 sig do params( source: Prism::Source, - index: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + index: T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode), collection: Prism::Node, statements: T.nilable(Prism::StatementsNode), for_keyword_loc: Prism::Location, in_keyword_loc: Prism::Location, do_keyword_loc: T.nilable(Prism::Location), - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).void end - def initialize(source, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7751 + # source://prism//lib/prism/node.rb#7322 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7602 + # source://prism//lib/prism/node.rb#7159 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7607 + # source://prism//lib/prism/node.rb#7164 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # attr_reader collection: Prism::node + # The collection to iterate over. + # + # for i in a end + # ^ # - # source://prism//lib/prism/node.rb#7642 + # source://prism//lib/prism/node.rb#7205 sig { returns(Prism::Node) } def collection; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7621 + # source://prism//lib/prism/node.rb#7178 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7612 + # source://prism//lib/prism/node.rb#7169 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?index: Prism::node, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location, ?location: Location) -> ForNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode # - # source://prism//lib/prism/node.rb#7626 + # source://prism//lib/prism/node.rb#7183 sig do params( - index: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + index: T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode), collection: Prism::Node, statements: T.nilable(Prism::StatementsNode), for_keyword_loc: Prism::Location, in_keyword_loc: Prism::Location, do_keyword_loc: T.nilable(Prism::Location), - end_keyword_loc: Prism::Location, - location: Prism::Location + end_keyword_loc: Prism::Location ).returns(Prism::ForNode) end - def copy(index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7607 + # source://prism//lib/prism/node.rb#7164 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { index: Prism::node, collection: Prism::node, statements: StatementsNode?, for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: Location?, end_keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode, collection: Prism::node, statements: StatementsNode?, for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: Location?, end_keyword_loc: Location } # - # source://prism//lib/prism/node.rb#7634 + # source://prism//lib/prism/node.rb#7191 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def do_keyword: () -> String? # - # source://prism//lib/prism/node.rb#7692 + # source://prism//lib/prism/node.rb#7296 sig { returns(T.nilable(String)) } def do_keyword; end - # attr_reader do_keyword_loc: Location? + # The location of the `do` keyword, if present. # - # source://prism//lib/prism/node.rb#7662 + # for i in a do end + # ^^ + # + # source://prism//lib/prism/node.rb#7251 sig { returns(T.nilable(Prism::Location)) } def do_keyword_loc; end # def end_keyword: () -> String # - # source://prism//lib/prism/node.rb#7697 + # source://prism//lib/prism/node.rb#7301 sig { returns(String) } def end_keyword; end - # attr_reader end_keyword_loc: Location + # The location of the `end` keyword. # - # source://prism//lib/prism/node.rb#7675 + # for i in a end + # ^^^ + # + # source://prism//lib/prism/node.rb#7273 sig { returns(Prism::Location) } def end_keyword_loc; end @@ -13958,74 +15957,96 @@ class Prism::ForNode < ::Prism::Node # def for_keyword: () -> String # - # source://prism//lib/prism/node.rb#7682 + # source://prism//lib/prism/node.rb#7286 sig { returns(String) } def for_keyword; end - # attr_reader for_keyword_loc: Location + # The location of the `for` keyword. # - # source://prism//lib/prism/node.rb#7648 + # for i in a end + # ^^^ + # + # source://prism//lib/prism/node.rb#7219 sig { returns(Prism::Location) } def for_keyword_loc; end # def in_keyword: () -> String # - # source://prism//lib/prism/node.rb#7687 + # source://prism//lib/prism/node.rb#7291 sig { returns(String) } def in_keyword; end - # attr_reader in_keyword_loc: Location + # The location of the `in` keyword. + # + # for i in a end + # ^^ # - # source://prism//lib/prism/node.rb#7655 + # source://prism//lib/prism/node.rb#7235 sig { returns(Prism::Location) } def in_keyword_loc; end - # attr_reader index: Prism::node + # The index expression for `for` loops. # - # source://prism//lib/prism/node.rb#7639 - sig { returns(Prism::Node) } + # for i in a end + # ^ + # + # source://prism//lib/prism/node.rb#7199 + sig do + returns(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)) + end def index; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7702 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7306 + sig { override.returns(String) } + def inspect; end - # attr_reader statements: StatementsNode? + # Save the do_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#7645 - sig { returns(T.nilable(Prism::StatementsNode)) } - def statements; end + # source://prism//lib/prism/node.rb#7265 + def save_do_keyword_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#7281 + def save_end_keyword_loc(repository); end + + # Save the for_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#7227 + def save_for_keyword_loc(repository); end + + # Save the in_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#7243 + def save_in_keyword_loc(repository); end + + # Represents the body of statements to execute for each iteration of the loop. # - # def type: () -> Symbol + # for i in a + # foo(i) + # ^^^^^^ + # end + # + # source://prism//lib/prism/node.rb#7213 + sig { returns(T.nilable(Prism::StatementsNode)) } + def statements; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7735 + # source://prism//lib/prism/node.rb#7311 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#7745 + # source://prism//lib/prism/node.rb#7316 def type; end end end @@ -14037,102 +16058,84 @@ end # ^^^ # end # -# source://prism//lib/prism/node.rb#7769 +# source://prism//lib/prism/node.rb#7340 class Prism::ForwardingArgumentsNode < ::Prism::Node - # def initialize: (Location location) -> void + # Initialize a new ForwardingArgumentsNode node. # # @return [ForwardingArgumentsNode] a new instance of ForwardingArgumentsNode # - # source://prism//lib/prism/node.rb#7771 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#7342 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7846 + # source://prism//lib/prism/node.rb#7399 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7778 + # source://prism//lib/prism/node.rb#7350 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7783 + # source://prism//lib/prism/node.rb#7355 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7793 + # source://prism//lib/prism/node.rb#7365 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7788 + # source://prism//lib/prism/node.rb#7360 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> ForwardingArgumentsNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingArgumentsNode # - # source://prism//lib/prism/node.rb#7798 - sig { params(location: Prism::Location).returns(Prism::ForwardingArgumentsNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7370 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ForwardingArgumentsNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7783 + # source://prism//lib/prism/node.rb#7355 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#7806 + # source://prism//lib/prism/node.rb#7378 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7811 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7383 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#7830 + # source://prism//lib/prism/node.rb#7388 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7840 + # source://prism//lib/prism/node.rb#7393 def type; end end end @@ -14143,102 +16146,84 @@ end # ^^^ # end # -# source://prism//lib/prism/node.rb#7856 +# source://prism//lib/prism/node.rb#7409 class Prism::ForwardingParameterNode < ::Prism::Node - # def initialize: (Location location) -> void + # Initialize a new ForwardingParameterNode node. # # @return [ForwardingParameterNode] a new instance of ForwardingParameterNode # - # source://prism//lib/prism/node.rb#7858 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#7411 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#7933 + # source://prism//lib/prism/node.rb#7468 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7865 + # source://prism//lib/prism/node.rb#7419 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7870 + # source://prism//lib/prism/node.rb#7424 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7880 + # source://prism//lib/prism/node.rb#7434 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7875 + # source://prism//lib/prism/node.rb#7429 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> ForwardingParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingParameterNode # - # source://prism//lib/prism/node.rb#7885 - sig { params(location: Prism::Location).returns(Prism::ForwardingParameterNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7439 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ForwardingParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7870 + # source://prism//lib/prism/node.rb#7424 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#7893 + # source://prism//lib/prism/node.rb#7447 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7898 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7452 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7917 + # source://prism//lib/prism/node.rb#7457 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#7927 + # source://prism//lib/prism/node.rb#7462 def type; end end end @@ -14248,108 +16233,105 @@ end # super # ^^^^^ # -# source://prism//lib/prism/node.rb#7942 +# source://prism//lib/prism/node.rb#7477 class Prism::ForwardingSuperNode < ::Prism::Node - # def initialize: (BlockNode? block, Location location) -> void + # Initialize a new ForwardingSuperNode node. # # @return [ForwardingSuperNode] a new instance of ForwardingSuperNode # - # source://prism//lib/prism/node.rb#7944 - sig { params(source: Prism::Source, block: T.nilable(Prism::BlockNode), location: Prism::Location).void } - def initialize(source, block, location); end + # source://prism//lib/prism/node.rb#7479 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + block: T.nilable(Prism::BlockNode) + ).void + end + def initialize(source, node_id, location, flags, block); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8031 + # source://prism//lib/prism/node.rb#7542 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#7952 + # source://prism//lib/prism/node.rb#7488 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader block: BlockNode? # - # source://prism//lib/prism/node.rb#7987 + # source://prism//lib/prism/node.rb#7523 sig { returns(T.nilable(Prism::BlockNode)) } def block; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7957 + # source://prism//lib/prism/node.rb#7493 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#7969 + # source://prism//lib/prism/node.rb#7505 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#7962 + # source://prism//lib/prism/node.rb#7498 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?block: BlockNode?, ?location: Location) -> ForwardingSuperNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?block: BlockNode?) -> ForwardingSuperNode # - # source://prism//lib/prism/node.rb#7974 - sig { params(block: T.nilable(Prism::BlockNode), location: Prism::Location).returns(Prism::ForwardingSuperNode) } - def copy(block: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7510 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + block: T.nilable(Prism::BlockNode) + ).returns(Prism::ForwardingSuperNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#7957 + # source://prism//lib/prism/node.rb#7493 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { block: BlockNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, block: BlockNode? } # - # source://prism//lib/prism/node.rb#7982 + # source://prism//lib/prism/node.rb#7518 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#7990 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7526 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8015 + # source://prism//lib/prism/node.rb#7531 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#8025 + # source://prism//lib/prism/node.rb#7536 def type; end end end @@ -14359,152 +16341,150 @@ end # $target &&= value # ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#8041 +# source://prism//lib/prism/node.rb#7552 class Prism::GlobalVariableAndWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new GlobalVariableAndWriteNode node. # # @return [GlobalVariableAndWriteNode] a new instance of GlobalVariableAndWriteNode # - # source://prism//lib/prism/node.rb#8043 + # source://prism//lib/prism/node.rb#7554 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8152 + # source://prism//lib/prism/node.rb#7652 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8054 + # source://prism//lib/prism/node.rb#7566 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8059 + # source://prism//lib/prism/node.rb#7571 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8069 + # source://prism//lib/prism/node.rb#7581 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8064 + # source://prism//lib/prism/node.rb#7576 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> GlobalVariableAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode # - # source://prism//lib/prism/node.rb#8074 + # source://prism//lib/prism/node.rb#7586 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::GlobalVariableAndWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8059 + # source://prism//lib/prism/node.rb#7571 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#8082 + # source://prism//lib/prism/node.rb#7594 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#163 + # source://prism//lib/prism/desugar_compiler.rb#200 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8112 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7636 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#8087 + # source://prism//lib/prism/node.rb#7599 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#8090 + # source://prism//lib/prism/node.rb#7602 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#8107 + # source://prism//lib/prism/node.rb#7631 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#8097 + # source://prism//lib/prism/node.rb#7615 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#7610 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#7623 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8136 + # source://prism//lib/prism/node.rb#7641 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#8104 + # source://prism//lib/prism/node.rb#7628 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8146 + # source://prism//lib/prism/node.rb#7646 def type; end end end @@ -14514,154 +16494,164 @@ end # $target += value # ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#8165 +# source://prism//lib/prism/node.rb#7665 class Prism::GlobalVariableOperatorWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Symbol operator, Location location) -> void + # Initialize a new GlobalVariableOperatorWriteNode node. # # @return [GlobalVariableOperatorWriteNode] a new instance of GlobalVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#8167 + # source://prism//lib/prism/node.rb#7667 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).void end - def initialize(source, name, name_loc, operator_loc, value, operator, location); end + def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8276 + # source://prism//lib/prism/node.rb#7764 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8179 + # source://prism//lib/prism/node.rb#7680 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader binary_operator: Symbol + # + # source://prism//lib/prism/node.rb#7745 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#7729 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8184 + # source://prism//lib/prism/node.rb#7685 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8194 + # source://prism//lib/prism/node.rb#7695 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8189 + # source://prism//lib/prism/node.rb#7690 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?operator: Symbol, ?location: Location) -> GlobalVariableOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#8199 + # source://prism//lib/prism/node.rb#7700 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, - operator_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - operator: Symbol, - location: Prism::Location + binary_operator: Symbol ).returns(Prism::GlobalVariableOperatorWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), operator: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8184 + # source://prism//lib/prism/node.rb#7685 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, operator: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # - # source://prism//lib/prism/node.rb#8207 + # source://prism//lib/prism/node.rb#7708 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#175 + # source://prism//lib/prism/desugar_compiler.rb#212 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8235 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7748 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#8212 + # source://prism//lib/prism/node.rb#7713 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#8215 + # source://prism//lib/prism/node.rb#7716 sig { returns(Prism::Location) } def name_loc; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#8232 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#403 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#8222 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#410 def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#7737 + def save_binary_operator_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#7724 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8260 + # source://prism//lib/prism/node.rb#7753 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#8229 + # source://prism//lib/prism/node.rb#7742 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8270 + # source://prism//lib/prism/node.rb#7758 def type; end end end @@ -14671,152 +16661,150 @@ end # $target ||= value # ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#8290 +# source://prism//lib/prism/node.rb#7778 class Prism::GlobalVariableOrWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new GlobalVariableOrWriteNode node. # # @return [GlobalVariableOrWriteNode] a new instance of GlobalVariableOrWriteNode # - # source://prism//lib/prism/node.rb#8292 + # source://prism//lib/prism/node.rb#7780 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, name, name_loc, operator_loc, value, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8401 + # source://prism//lib/prism/node.rb#7878 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8303 + # source://prism//lib/prism/node.rb#7792 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8308 + # source://prism//lib/prism/node.rb#7797 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8318 + # source://prism//lib/prism/node.rb#7807 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8313 + # source://prism//lib/prism/node.rb#7802 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> GlobalVariableOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode # - # source://prism//lib/prism/node.rb#8323 + # source://prism//lib/prism/node.rb#7812 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::GlobalVariableOrWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8308 + # source://prism//lib/prism/node.rb#7797 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#8331 + # source://prism//lib/prism/node.rb#7820 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # source://prism//lib/prism/desugar_compiler.rb#169 + # source://prism//lib/prism/desugar_compiler.rb#206 def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8361 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7862 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#8336 + # source://prism//lib/prism/node.rb#7825 sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#8339 + # source://prism//lib/prism/node.rb#7828 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#8356 + # source://prism//lib/prism/node.rb#7857 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#8346 + # source://prism//lib/prism/node.rb#7841 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#7836 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#7849 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8385 + # source://prism//lib/prism/node.rb#7867 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#8353 + # source://prism//lib/prism/node.rb#7854 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8395 + # source://prism//lib/prism/node.rb#7872 def type; end end end @@ -14826,73 +16814,80 @@ end # $foo # ^^^^ # -# source://prism//lib/prism/node.rb#8414 +# source://prism//lib/prism/node.rb#7891 class Prism::GlobalVariableReadNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new GlobalVariableReadNode node. # # @return [GlobalVariableReadNode] a new instance of GlobalVariableReadNode # - # source://prism//lib/prism/node.rb#8416 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#7893 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8500 + # source://prism//lib/prism/node.rb#7958 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8424 + # source://prism//lib/prism/node.rb#7902 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8429 + # source://prism//lib/prism/node.rb#7907 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8439 + # source://prism//lib/prism/node.rb#7917 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8434 + # source://prism//lib/prism/node.rb#7912 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> GlobalVariableReadNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode # - # source://prism//lib/prism/node.rb#8444 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::GlobalVariableReadNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7922 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableReadNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8429 + # source://prism//lib/prism/node.rb#7907 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#8452 + # source://prism//lib/prism/node.rb#7930 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8464 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7942 + sig { override.returns(String) } + def inspect; end # The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol. # @@ -14900,38 +16895,20 @@ class Prism::GlobalVariableReadNode < ::Prism::Node # # $_Test # name `:$_Test` # - # source://prism//lib/prism/node.rb#8461 + # source://prism//lib/prism/node.rb#7939 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8484 + # source://prism//lib/prism/node.rb#7947 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#8494 + # source://prism//lib/prism/node.rb#7952 def type; end end end @@ -14941,108 +16918,97 @@ end # $foo, $bar = baz # ^^^^ ^^^^ # -# source://prism//lib/prism/node.rb#8510 +# source://prism//lib/prism/node.rb#7968 class Prism::GlobalVariableTargetNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Initialize a new GlobalVariableTargetNode node. # # @return [GlobalVariableTargetNode] a new instance of GlobalVariableTargetNode # - # source://prism//lib/prism/node.rb#8512 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/node.rb#7970 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8592 + # source://prism//lib/prism/node.rb#8031 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8520 + # source://prism//lib/prism/node.rb#7979 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8525 + # source://prism//lib/prism/node.rb#7984 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8535 + # source://prism//lib/prism/node.rb#7994 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8530 + # source://prism//lib/prism/node.rb#7989 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?location: Location) -> GlobalVariableTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode # - # source://prism//lib/prism/node.rb#8540 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::GlobalVariableTargetNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#7999 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableTargetNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8525 + # source://prism//lib/prism/node.rb#7984 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#8548 + # source://prism//lib/prism/node.rb#8007 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8556 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8015 + sig { override.returns(String) } + def inspect; end # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#8553 + # source://prism//lib/prism/node.rb#8012 sig { returns(Symbol) } def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8576 + # source://prism//lib/prism/node.rb#8020 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#8586 + # source://prism//lib/prism/node.rb#8025 def type; end end end @@ -15052,90 +17018,94 @@ end # $foo = 1 # ^^^^^^^^ # -# source://prism//lib/prism/node.rb#8602 +# source://prism//lib/prism/node.rb#8041 class Prism::GlobalVariableWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Prism::node value, Location operator_loc, Location location) -> void + # Initialize a new GlobalVariableWriteNode node. # # @return [GlobalVariableWriteNode] a new instance of GlobalVariableWriteNode # - # source://prism//lib/prism/node.rb#8604 + # source://prism//lib/prism/node.rb#8043 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).void end - def initialize(source, name, name_loc, value, operator_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8729 + # source://prism//lib/prism/node.rb#8157 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8615 + # source://prism//lib/prism/node.rb#8055 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8620 + # source://prism//lib/prism/node.rb#8060 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8630 + # source://prism//lib/prism/node.rb#8070 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8625 + # source://prism//lib/prism/node.rb#8065 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location, ?location: Location) -> GlobalVariableWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode # - # source://prism//lib/prism/node.rb#8635 + # source://prism//lib/prism/node.rb#8075 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, name_loc: Prism::Location, value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + operator_loc: Prism::Location ).returns(Prism::GlobalVariableWriteNode) end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8620 + # source://prism//lib/prism/node.rb#8060 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#8643 + # source://prism//lib/prism/node.rb#8083 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8689 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8141 + sig { override.returns(String) } + def inspect; end # The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol. # @@ -15143,7 +17113,7 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # # $_Test = 123 # name `:$_Test` # - # source://prism//lib/prism/node.rb#8652 + # source://prism//lib/prism/node.rb#8092 sig { returns(Symbol) } def name; end @@ -15152,13 +17122,13 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # $foo = :bar # ^^^^ # - # source://prism//lib/prism/node.rb#8658 + # source://prism//lib/prism/node.rb#8098 sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#8684 + # source://prism//lib/prism/node.rb#8136 sig { returns(String) } def operator; end @@ -15167,26 +17137,25 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # $foo = :bar # ^ # - # source://prism//lib/prism/node.rb#8677 + # source://prism//lib/prism/node.rb#8123 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#8106 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#8131 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8713 + # source://prism//lib/prism/node.rb#8146 sig { override.returns(Symbol) } def type; end @@ -15198,19 +17167,14 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # $-xyz = 123 # ^^^ # - # source://prism//lib/prism/node.rb#8671 + # source://prism//lib/prism/node.rb#8117 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#8723 + # source://prism//lib/prism/node.rb#8151 def type; end end end @@ -15220,45 +17184,47 @@ end # { a => b } # ^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#8742 +# source://prism//lib/prism/node.rb#8170 class Prism::HashNode < ::Prism::Node - # def initialize: (Location opening_loc, Array[AssocNode | AssocSplatNode] elements, Location closing_loc, Location location) -> void + # Initialize a new HashNode node. # # @return [HashNode] a new instance of HashNode # - # source://prism//lib/prism/node.rb#8744 + # source://prism//lib/prism/node.rb#8172 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).void end - def initialize(source, opening_loc, elements, closing_loc, location); end + def initialize(source, node_id, location, flags, opening_loc, elements, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#8864 + # source://prism//lib/prism/node.rb#8283 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8754 + # source://prism//lib/prism/node.rb#8183 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8759 + # source://prism//lib/prism/node.rb#8188 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#8821 + # source://prism//lib/prism/node.rb#8262 sig { returns(String) } def closing; end @@ -15267,45 +17233,47 @@ class Prism::HashNode < ::Prism::Node # { a => b } # ^ # - # source://prism//lib/prism/node.rb#8809 + # source://prism//lib/prism/node.rb#8244 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8769 + # source://prism//lib/prism/node.rb#8198 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8764 + # source://prism//lib/prism/node.rb#8193 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location, ?location: Location) -> HashNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode # - # source://prism//lib/prism/node.rb#8774 + # source://prism//lib/prism/node.rb#8203 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], - closing_loc: Prism::Location, - location: Prism::Location + closing_loc: Prism::Location ).returns(Prism::HashNode) end - def copy(opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8759 + # source://prism//lib/prism/node.rb#8188 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { opening_loc: Location, elements: Array[AssocNode | AssocSplatNode], closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, elements: Array[AssocNode | AssocSplatNode], closing_loc: Location } # - # source://prism//lib/prism/node.rb#8782 + # source://prism//lib/prism/node.rb#8211 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -15317,22 +17285,22 @@ class Prism::HashNode < ::Prism::Node # { **foo } # ^^^^^ # - # source://prism//lib/prism/node.rb#8803 + # source://prism//lib/prism/node.rb#8238 sig { returns(T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)]) } def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8826 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8267 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#8816 + # source://prism//lib/prism/node.rb#8257 sig { returns(String) } def opening; end @@ -15341,38 +17309,32 @@ class Prism::HashNode < ::Prism::Node # { a => b } # ^ # - # source://prism//lib/prism/node.rb#8790 + # source://prism//lib/prism/node.rb#8219 sig { returns(Prism::Location) } def opening_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#8252 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#8227 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#8848 + # source://prism//lib/prism/node.rb#8272 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#8858 + # source://prism//lib/prism/node.rb#8277 def type; end end end @@ -15385,174 +17347,172 @@ end # foo => { a: 1, b: 2, **c } # ^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#8880 +# source://prism//lib/prism/node.rb#8299 class Prism::HashPatternNode < ::Prism::Node - # def initialize: (Prism::node? constant, Array[AssocNode] elements, AssocSplatNode | NoKeywordsParameterNode | nil rest, Location? opening_loc, Location? closing_loc, Location location) -> void + # Initialize a new HashPatternNode node. # # @return [HashPatternNode] a new instance of HashPatternNode # - # source://prism//lib/prism/node.rb#8882 + # source://prism//lib/prism/node.rb#8301 sig do params( source: Prism::Source, - constant: T.nilable(Prism::Node), + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), elements: T::Array[Prism::AssocNode], rest: T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode)), opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, constant, elements, rest, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9026 + # source://prism//lib/prism/node.rb#8424 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#8894 + # source://prism//lib/prism/node.rb#8314 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8899 + # source://prism//lib/prism/node.rb#8319 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#8971 + # source://prism//lib/prism/node.rb#8403 sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # - # source://prism//lib/prism/node.rb#8953 + # source://prism//lib/prism/node.rb#8379 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#8913 + # source://prism//lib/prism/node.rb#8333 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#8904 + # source://prism//lib/prism/node.rb#8324 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader constant: Prism::node? + # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # - # source://prism//lib/prism/node.rb#8931 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#8351 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end - # def copy: (?constant: Prism::node?, ?elements: Array[AssocNode], ?rest: AssocSplatNode | NoKeywordsParameterNode | nil, ?opening_loc: Location?, ?closing_loc: Location?, ?location: Location) -> HashPatternNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?elements: Array[AssocNode], ?rest: AssocSplatNode | NoKeywordsParameterNode | nil, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode # - # source://prism//lib/prism/node.rb#8918 + # source://prism//lib/prism/node.rb#8338 sig do params( - constant: T.nilable(Prism::Node), + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), elements: T::Array[Prism::AssocNode], rest: T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode)), opening_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + closing_loc: T.nilable(Prism::Location) ).returns(Prism::HashPatternNode) end - def copy(constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#8899 + # source://prism//lib/prism/node.rb#8319 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { constant: Prism::node?, elements: Array[AssocNode], rest: AssocSplatNode | NoKeywordsParameterNode | nil, opening_loc: Location?, closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, elements: Array[AssocNode], rest: AssocSplatNode | NoKeywordsParameterNode | nil, opening_loc: Location?, closing_loc: Location? } # - # source://prism//lib/prism/node.rb#8926 + # source://prism//lib/prism/node.rb#8346 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader elements: Array[AssocNode] # - # source://prism//lib/prism/node.rb#8934 + # source://prism//lib/prism/node.rb#8354 sig { returns(T::Array[Prism::AssocNode]) } def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#8976 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8408 + sig { override.returns(String) } + def inspect; end # def opening: () -> String? # - # source://prism//lib/prism/node.rb#8966 + # source://prism//lib/prism/node.rb#8398 sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # - # source://prism//lib/prism/node.rb#8940 + # source://prism//lib/prism/node.rb#8360 sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader rest: AssocSplatNode | NoKeywordsParameterNode | nil # - # source://prism//lib/prism/node.rb#8937 + # source://prism//lib/prism/node.rb#8357 sig { returns(T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode))) } def rest; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#8393 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#8374 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#9010 + # source://prism//lib/prism/node.rb#8413 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#9020 + # source://prism//lib/prism/node.rb#8418 def type; end end end -# source://prism//lib/prism/node_ext.rb#35 +# source://prism//lib/prism/node_ext.rb#52 module Prism::HeredocQuery # Returns true if this node was represented as a heredoc in the source code. # # @return [Boolean] # - # source://prism//lib/prism/node_ext.rb#37 + # source://prism//lib/prism/node_ext.rb#54 def heredoc?; end end @@ -15567,107 +17527,99 @@ end # foo ? bar : baz # ^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#9047 +# source://prism//lib/prism/node.rb#8445 class Prism::IfNode < ::Prism::Node - # def initialize: (Location? if_keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, Prism::node? consequent, Location? end_keyword_loc, Location location) -> void + # Initialize a new IfNode node. # # @return [IfNode] a new instance of IfNode # - # source://prism//lib/prism/node.rb#9049 + # source://prism//lib/prism/node.rb#8447 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, if_keyword_loc: T.nilable(Prism::Location), predicate: Prism::Node, then_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::Node), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + subsequent: T.nilable(T.any(Prism::ElseNode, Prism::IfNode)), + end_keyword_loc: T.nilable(Prism::Location) ).void end - def initialize(source, if_keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9264 + # source://prism//lib/prism/node.rb#8641 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9062 + # source://prism//lib/prism/node.rb#8461 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9071 + # source://prism//lib/prism/node.rb#8466 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9085 + # source://prism//lib/prism/node.rb#8480 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9076 + # source://prism//lib/prism/node.rb#8471 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement. - # - # if foo - # bar - # elsif baz - # ^^^^^^^^^ - # qux - # ^^^ - # end - # ^^^ - # - # if foo then bar else baz end - # ^^^^^^^^^^^^ + # Returns the subsequent if/elsif/else clause of the if node. This method is + # deprecated in favor of #subsequent. # - # source://prism//lib/prism/node.rb#9176 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node_ext.rb#485 def consequent; end - # def copy: (?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?consequent: Prism::node?, ?end_keyword_loc: Location?, ?location: Location) -> IfNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: ElseNode | IfNode | nil, ?end_keyword_loc: Location?) -> IfNode # - # source://prism//lib/prism/node.rb#9090 + # source://prism//lib/prism/node.rb#8485 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, if_keyword_loc: T.nilable(Prism::Location), predicate: Prism::Node, then_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::Node), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + subsequent: T.nilable(T.any(Prism::ElseNode, Prism::IfNode)), + end_keyword_loc: T.nilable(Prism::Location) ).returns(Prism::IfNode) end - def copy(if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), consequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9071 + # source://prism//lib/prism/node.rb#8466 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { if_keyword_loc: Location?, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: Prism::node?, end_keyword_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, if_keyword_loc: Location?, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, subsequent: ElseNode | IfNode | nil, end_keyword_loc: Location? } # - # source://prism//lib/prism/node.rb#9098 + # source://prism//lib/prism/node.rb#8493 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String? # - # source://prism//lib/prism/node.rb#9207 + # source://prism//lib/prism/node.rb#8620 sig { returns(T.nilable(String)) } def end_keyword; end @@ -15678,7 +17630,7 @@ class Prism::IfNode < ::Prism::Node # end # ^^^ # - # source://prism//lib/prism/node.rb#9184 + # source://prism//lib/prism/node.rb#8591 sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end @@ -15687,7 +17639,7 @@ class Prism::IfNode < ::Prism::Node # def if_keyword: () -> String? # - # source://prism//lib/prism/node.rb#9197 + # source://prism//lib/prism/node.rb#8610 sig { returns(T.nilable(String)) } def if_keyword; end @@ -15698,15 +17650,18 @@ class Prism::IfNode < ::Prism::Node # # The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression. # - # source://prism//lib/prism/node.rb#9108 + # source://prism//lib/prism/node.rb#8503 sig { returns(T.nilable(Prism::Location)) } def if_keyword_loc; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9212 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8625 + sig { override.returns(String) } + def inspect; end + + # source://prism//lib/prism/parse_result/newlines.rb#91 + def newline_flag!(lines); end # The node for the condition the `IfNode` is testing. # @@ -15721,12 +17676,27 @@ class Prism::IfNode < ::Prism::Node # foo ? bar : baz # ^^^ # - # source://prism//lib/prism/node.rb#9132 + # source://prism//lib/prism/node.rb#8533 sig { returns(Prism::Node) } def predicate; end - # source://prism//lib/prism/node.rb#9066 - def set_newline_flag(newline_marked); end + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#8605 + def save_end_keyword_loc(repository); end + + # Save the if_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#8517 + def save_if_keyword_loc(repository); end + + # Save the then_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#8556 + def save_then_keyword_loc(repository); end # Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided. # @@ -15737,13 +17707,31 @@ class Prism::IfNode < ::Prism::Node # ^^^ # end # - # source://prism//lib/prism/node.rb#9161 + # source://prism//lib/prism/node.rb#8568 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end + # Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement. + # + # if foo + # bar + # elsif baz + # ^^^^^^^^^ + # qux + # ^^^ + # end + # ^^^ + # + # if foo then bar else baz end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/node.rb#8583 + sig { returns(T.nilable(T.any(Prism::ElseNode, Prism::IfNode))) } + def subsequent; end + # def then_keyword: () -> String? # - # source://prism//lib/prism/node.rb#9202 + # source://prism//lib/prism/node.rb#8615 sig { returns(T.nilable(String)) } def then_keyword; end @@ -15755,38 +17743,20 @@ class Prism::IfNode < ::Prism::Node # a ? b : c # ^ # - # source://prism//lib/prism/node.rb#9141 + # source://prism//lib/prism/node.rb#8542 sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9248 + # source://prism//lib/prism/node.rb#8630 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9258 + # source://prism//lib/prism/node.rb#8635 def type; end end end @@ -15796,125 +17766,111 @@ end # 1.0i # ^^^^ # -# source://prism//lib/prism/node.rb#9279 +# source://prism//lib/prism/node.rb#8656 class Prism::ImaginaryNode < ::Prism::Node - # def initialize: (FloatNode | IntegerNode | RationalNode numeric, Location location) -> void + # Initialize a new ImaginaryNode node. # # @return [ImaginaryNode] a new instance of ImaginaryNode # - # source://prism//lib/prism/node.rb#9281 + # source://prism//lib/prism/node.rb#8658 sig do params( source: Prism::Source, - numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode), - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode) ).void end - def initialize(source, numeric, location); end + def initialize(source, node_id, location, flags, numeric); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9362 + # source://prism//lib/prism/node.rb#8719 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9289 + # source://prism//lib/prism/node.rb#8667 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9294 + # source://prism//lib/prism/node.rb#8672 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9304 + # source://prism//lib/prism/node.rb#8682 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9299 + # source://prism//lib/prism/node.rb#8677 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?numeric: FloatNode | IntegerNode | RationalNode, ?location: Location) -> ImaginaryNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numeric: FloatNode | IntegerNode | RationalNode) -> ImaginaryNode # - # source://prism//lib/prism/node.rb#9309 + # source://prism//lib/prism/node.rb#8687 sig do params( - numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode), - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode) ).returns(Prism::ImaginaryNode) end - def copy(numeric: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numeric: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9294 + # source://prism//lib/prism/node.rb#8672 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { numeric: FloatNode | IntegerNode | RationalNode, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, numeric: FloatNode | IntegerNode | RationalNode } # - # source://prism//lib/prism/node.rb#9317 + # source://prism//lib/prism/node.rb#8695 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9325 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8703 + sig { override.returns(String) } + def inspect; end # attr_reader numeric: FloatNode | IntegerNode | RationalNode # - # source://prism//lib/prism/node.rb#9322 + # source://prism//lib/prism/node.rb#8700 sig { returns(T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode)) } def numeric; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9346 + # source://prism//lib/prism/node.rb#8708 sig { override.returns(Symbol) } def type; end # Returns the value of the node as a Ruby Complex. # - # source://prism//lib/prism/node_ext.rb#87 + # source://prism//lib/prism/node_ext.rb#107 sig { returns(Complex) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#9356 + # source://prism//lib/prism/node.rb#8713 def type; end end end @@ -15930,108 +17886,107 @@ end # foo in { bar: } # ^^^^ # -# source://prism//lib/prism/node.rb#9378 +# source://prism//lib/prism/node.rb#8735 class Prism::ImplicitNode < ::Prism::Node - # def initialize: (Prism::node value, Location location) -> void + # Initialize a new ImplicitNode node. # # @return [ImplicitNode] a new instance of ImplicitNode # - # source://prism//lib/prism/node.rb#9380 - sig { params(source: Prism::Source, value: Prism::Node, location: Prism::Location).void } - def initialize(source, value, location); end + # source://prism//lib/prism/node.rb#8737 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode) + ).void + end + def initialize(source, node_id, location, flags, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9461 + # source://prism//lib/prism/node.rb#8798 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9388 + # source://prism//lib/prism/node.rb#8746 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9393 + # source://prism//lib/prism/node.rb#8751 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9403 + # source://prism//lib/prism/node.rb#8761 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9398 + # source://prism//lib/prism/node.rb#8756 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Prism::node, ?location: Location) -> ImplicitNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode # - # source://prism//lib/prism/node.rb#9408 - sig { params(value: Prism::Node, location: Prism::Location).returns(Prism::ImplicitNode) } - def copy(value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8766 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode) + ).returns(Prism::ImplicitNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9393 + # source://prism//lib/prism/node.rb#8751 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode } # - # source://prism//lib/prism/node.rb#9416 + # source://prism//lib/prism/node.rb#8774 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9424 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8782 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#9445 + # source://prism//lib/prism/node.rb#8787 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node + # attr_reader value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode # - # source://prism//lib/prism/node.rb#9421 - sig { returns(Prism::Node) } + # source://prism//lib/prism/node.rb#8779 + sig do + returns(T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode)) + end def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9455 + # source://prism//lib/prism/node.rb#8792 def type; end end end @@ -16050,102 +18005,84 @@ end # foo, = bar # ^ # -# source://prism//lib/prism/node.rb#9480 +# source://prism//lib/prism/node.rb#8817 class Prism::ImplicitRestNode < ::Prism::Node - # def initialize: (Location location) -> void + # Initialize a new ImplicitRestNode node. # # @return [ImplicitRestNode] a new instance of ImplicitRestNode # - # source://prism//lib/prism/node.rb#9482 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#8819 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9557 + # source://prism//lib/prism/node.rb#8876 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9489 + # source://prism//lib/prism/node.rb#8827 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9494 + # source://prism//lib/prism/node.rb#8832 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9504 + # source://prism//lib/prism/node.rb#8842 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9499 + # source://prism//lib/prism/node.rb#8837 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> ImplicitRestNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ImplicitRestNode # - # source://prism//lib/prism/node.rb#9509 - sig { params(location: Prism::Location).returns(Prism::ImplicitRestNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8847 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ImplicitRestNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9494 + # source://prism//lib/prism/node.rb#8832 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#9517 + # source://prism//lib/prism/node.rb#8855 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9522 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8860 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9541 + # source://prism//lib/prism/node.rb#8865 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#9551 + # source://prism//lib/prism/node.rb#8870 def type; end end end @@ -16155,79 +18092,83 @@ end # case a; in b then c end # ^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#9566 +# source://prism//lib/prism/node.rb#8885 class Prism::InNode < ::Prism::Node - # def initialize: (Prism::node pattern, StatementsNode? statements, Location in_loc, Location? then_loc, Location location) -> void + # Initialize a new InNode node. # # @return [InNode] a new instance of InNode # - # source://prism//lib/prism/node.rb#9568 + # source://prism//lib/prism/node.rb#8887 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, pattern: Prism::Node, statements: T.nilable(Prism::StatementsNode), in_loc: Prism::Location, - then_loc: T.nilable(Prism::Location), - location: Prism::Location + then_loc: T.nilable(Prism::Location) ).void end - def initialize(source, pattern, statements, in_loc, then_loc, location); end + def initialize(source, node_id, location, flags, pattern, statements, in_loc, then_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9696 + # source://prism//lib/prism/node.rb#8999 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9579 + # source://prism//lib/prism/node.rb#8899 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9584 + # source://prism//lib/prism/node.rb#8904 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9597 + # source://prism//lib/prism/node.rb#8917 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9589 + # source://prism//lib/prism/node.rb#8909 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?, ?location: Location) -> InNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode # - # source://prism//lib/prism/node.rb#9602 + # source://prism//lib/prism/node.rb#8922 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, pattern: Prism::Node, statements: T.nilable(Prism::StatementsNode), in_loc: Prism::Location, - then_loc: T.nilable(Prism::Location), - location: Prism::Location + then_loc: T.nilable(Prism::Location) ).returns(Prism::InNode) end - def copy(pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9584 + # source://prism//lib/prism/node.rb#8904 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { pattern: Prism::node, statements: StatementsNode?, in_loc: Location, then_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, pattern: Prism::node, statements: StatementsNode?, in_loc: Location, then_loc: Location? } # - # source://prism//lib/prism/node.rb#9610 + # source://prism//lib/prism/node.rb#8930 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -16236,74 +18177,68 @@ class Prism::InNode < ::Prism::Node # def in: () -> String # - # source://prism//lib/prism/node.rb#9641 + # source://prism//lib/prism/node.rb#8973 sig { returns(String) } def in; end # attr_reader in_loc: Location # - # source://prism//lib/prism/node.rb#9621 + # source://prism//lib/prism/node.rb#8941 sig { returns(Prism::Location) } def in_loc; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9651 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#8983 + sig { override.returns(String) } + def inspect; end # attr_reader pattern: Prism::node # - # source://prism//lib/prism/node.rb#9615 + # source://prism//lib/prism/node.rb#8935 sig { returns(Prism::Node) } def pattern; end + # Save the in_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#8949 + def save_in_loc(repository); end + + # Save the then_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#8968 + def save_then_loc(repository); end + # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#9618 + # source://prism//lib/prism/node.rb#8938 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then: () -> String? # - # source://prism//lib/prism/node.rb#9646 + # source://prism//lib/prism/node.rb#8978 sig { returns(T.nilable(String)) } def then; end # attr_reader then_loc: Location? # - # source://prism//lib/prism/node.rb#9628 + # source://prism//lib/prism/node.rb#8954 sig { returns(T.nilable(Prism::Location)) } def then_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#9680 + # source://prism//lib/prism/node.rb#8988 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#9690 + # source://prism//lib/prism/node.rb#8993 def type; end end end @@ -16313,45 +18248,46 @@ end # foo.bar[baz] &&= value # ^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#9709 +# source://prism//lib/prism/node.rb#9012 class Prism::IndexAndWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new IndexAndWriteNode node. # # @return [IndexAndWriteNode] a new instance of IndexAndWriteNode # - # source://prism//lib/prism/node.rb#9711 + # source://prism//lib/prism/node.rb#9014 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), + block: T.nilable(Prism::BlockArgumentNode), operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#9916 + # source://prism//lib/prism/node.rb#9194 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9727 + # source://prism//lib/prism/node.rb#9030 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/node.rb#9792 + # source://prism//lib/prism/node.rb#9123 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end @@ -16359,87 +18295,88 @@ class Prism::IndexAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#9825 + # source://prism//lib/prism/node.rb#9078 sig { returns(T::Boolean) } def attribute_write?; end - # attr_reader block: Prism::node? + # attr_reader block: BlockArgumentNode? # - # source://prism//lib/prism/node.rb#9802 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#9139 + sig { returns(T.nilable(Prism::BlockArgumentNode)) } def block; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#9835 + # source://prism//lib/prism/node.rb#9158 sig { returns(T.nilable(String)) } def call_operator; end # attr_reader call_operator_loc: Location? # - # source://prism//lib/prism/node.rb#9772 + # source://prism//lib/prism/node.rb#9091 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9732 + # source://prism//lib/prism/node.rb#9035 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#9845 + # source://prism//lib/prism/node.rb#9168 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#9795 + # source://prism//lib/prism/node.rb#9126 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9747 + # source://prism//lib/prism/node.rb#9050 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9737 + # source://prism//lib/prism/node.rb#9040 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> IndexAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode # - # source://prism//lib/prism/node.rb#9752 + # source://prism//lib/prism/node.rb#9055 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), + block: T.nilable(Prism::BlockArgumentNode), operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::IndexAndWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9732 + # source://prism//lib/prism/node.rb#9035 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: BlockArgumentNode?, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#9760 + # source://prism//lib/prism/node.rb#9063 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -16450,43 +18387,43 @@ class Prism::IndexAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#9830 + # source://prism//lib/prism/node.rb#9083 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#9855 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#9178 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#9840 + # source://prism//lib/prism/node.rb#9163 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#9785 + # source://prism//lib/prism/node.rb#9110 sig { returns(Prism::Location) } def opening_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#9850 + # source://prism//lib/prism/node.rb#9173 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#9805 + # source://prism//lib/prism/node.rb#9142 sig { returns(Prism::Location) } def operator_loc; end # attr_reader receiver: Prism::node? # - # source://prism//lib/prism/node.rb#9769 + # source://prism//lib/prism/node.rb#9088 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -16494,32 +18431,43 @@ class Prism::IndexAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#9815 + # source://prism//lib/prism/node.rb#9068 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#9105 + def save_call_operator_loc(repository); end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9134 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#9118 + def save_opening_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9150 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#9900 + # source://prism//lib/prism/node.rb#9183 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#9812 + # source://prism//lib/prism/node.rb#9155 sig { returns(Prism::Node) } def value; end @@ -16527,27 +18475,14 @@ class Prism::IndexAndWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#9820 + # source://prism//lib/prism/node.rb#9073 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#9765 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#9910 + # source://prism//lib/prism/node.rb#9188 def type; end end end @@ -16557,46 +18492,47 @@ end # foo.bar[baz] += value # ^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#9934 +# source://prism//lib/prism/node.rb#9212 class Prism::IndexOperatorWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Symbol operator, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new IndexOperatorWriteNode node. # # @return [IndexOperatorWriteNode] a new instance of IndexOperatorWriteNode # - # source://prism//lib/prism/node.rb#9936 + # source://prism//lib/prism/node.rb#9214 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), - operator: Symbol, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + block: T.nilable(Prism::BlockArgumentNode), + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#10141 + # source://prism//lib/prism/node.rb#9393 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#9953 + # source://prism//lib/prism/node.rb#9231 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/node.rb#10018 + # source://prism//lib/prism/node.rb#9324 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end @@ -16604,88 +18540,101 @@ class Prism::IndexOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10054 + # source://prism//lib/prism/node.rb#9279 sig { returns(T::Boolean) } def attribute_write?; end - # attr_reader block: Prism::node? + # attr_reader binary_operator: Symbol # - # source://prism//lib/prism/node.rb#10028 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#9343 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#9346 + sig { returns(Prism::Location) } + def binary_operator_loc; end + + # attr_reader block: BlockArgumentNode? + # + # source://prism//lib/prism/node.rb#9340 + sig { returns(T.nilable(Prism::BlockArgumentNode)) } def block; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#10064 + # source://prism//lib/prism/node.rb#9362 sig { returns(T.nilable(String)) } def call_operator; end # attr_reader call_operator_loc: Location? # - # source://prism//lib/prism/node.rb#9998 + # source://prism//lib/prism/node.rb#9292 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9958 + # source://prism//lib/prism/node.rb#9236 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#10074 + # source://prism//lib/prism/node.rb#9372 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#10021 + # source://prism//lib/prism/node.rb#9327 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#9973 + # source://prism//lib/prism/node.rb#9251 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#9963 + # source://prism//lib/prism/node.rb#9241 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?operator: Symbol, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> IndexOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode # - # source://prism//lib/prism/node.rb#9978 + # source://prism//lib/prism/node.rb#9256 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), - operator: Symbol, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + block: T.nilable(Prism::BlockArgumentNode), + binary_operator: Symbol, + binary_operator_loc: Prism::Location, + value: Prism::Node ).returns(Prism::IndexOperatorWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#9958 + # source://prism//lib/prism/node.rb#9236 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?, operator: Symbol, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: BlockArgumentNode?, binary_operator: Symbol, binary_operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#9986 + # source://prism//lib/prism/node.rb#9264 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -16696,43 +18645,43 @@ class Prism::IndexOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10059 + # source://prism//lib/prism/node.rb#9284 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#10079 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#9377 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#10069 + # source://prism//lib/prism/node.rb#9367 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#10011 + # source://prism//lib/prism/node.rb#9311 sig { returns(Prism::Location) } def opening_loc; end - # attr_reader operator: Symbol + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#10031 - sig { returns(Symbol) } + # source://prism//lib/prism/node_ext.rb#419 def operator; end - # attr_reader operator_loc: Location + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#10034 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node_ext.rb#426 def operator_loc; end # attr_reader receiver: Prism::node? # - # source://prism//lib/prism/node.rb#9995 + # source://prism//lib/prism/node.rb#9289 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -16740,32 +18689,43 @@ class Prism::IndexOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10044 + # source://prism//lib/prism/node.rb#9269 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#9354 + def save_binary_operator_loc(repository); end + + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9306 + def save_call_operator_loc(repository); end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9335 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#9319 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#10125 + # source://prism//lib/prism/node.rb#9382 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#10041 + # source://prism//lib/prism/node.rb#9359 sig { returns(Prism::Node) } def value; end @@ -16773,27 +18733,14 @@ class Prism::IndexOperatorWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10049 + # source://prism//lib/prism/node.rb#9274 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#9991 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10135 + # source://prism//lib/prism/node.rb#9387 def type; end end end @@ -16803,45 +18750,46 @@ end # foo.bar[baz] ||= value # ^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#10160 +# source://prism//lib/prism/node.rb#9412 class Prism::IndexOrWriteNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Location operator_loc, Prism::node value, Location location) -> void + # Initialize a new IndexOrWriteNode node. # # @return [IndexOrWriteNode] a new instance of IndexOrWriteNode # - # source://prism//lib/prism/node.rb#10162 + # source://prism//lib/prism/node.rb#9414 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), + block: T.nilable(Prism::BlockArgumentNode), operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location); end + def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#10367 + # source://prism//lib/prism/node.rb#9594 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#10178 + # source://prism//lib/prism/node.rb#9430 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/node.rb#10243 + # source://prism//lib/prism/node.rb#9523 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end @@ -16849,87 +18797,88 @@ class Prism::IndexOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10276 + # source://prism//lib/prism/node.rb#9478 sig { returns(T::Boolean) } def attribute_write?; end - # attr_reader block: Prism::node? + # attr_reader block: BlockArgumentNode? # - # source://prism//lib/prism/node.rb#10253 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#9539 + sig { returns(T.nilable(Prism::BlockArgumentNode)) } def block; end # def call_operator: () -> String? # - # source://prism//lib/prism/node.rb#10286 + # source://prism//lib/prism/node.rb#9558 sig { returns(T.nilable(String)) } def call_operator; end # attr_reader call_operator_loc: Location? # - # source://prism//lib/prism/node.rb#10223 + # source://prism//lib/prism/node.rb#9491 sig { returns(T.nilable(Prism::Location)) } def call_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#10183 + # source://prism//lib/prism/node.rb#9435 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#10296 + # source://prism//lib/prism/node.rb#9568 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#10246 + # source://prism//lib/prism/node.rb#9526 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#10198 + # source://prism//lib/prism/node.rb#9450 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#10188 + # source://prism//lib/prism/node.rb#9440 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> IndexOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode # - # source://prism//lib/prism/node.rb#10203 + # source://prism//lib/prism/node.rb#9455 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: T.nilable(Prism::Node), call_operator_loc: T.nilable(Prism::Location), opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), + block: T.nilable(Prism::BlockArgumentNode), operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location + value: Prism::Node ).returns(Prism::IndexOrWriteNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#10183 + # source://prism//lib/prism/node.rb#9435 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?, operator_loc: Location, value: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: BlockArgumentNode?, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#10211 + # source://prism//lib/prism/node.rb#9463 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -16940,43 +18889,43 @@ class Prism::IndexOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10281 + # source://prism//lib/prism/node.rb#9483 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#10306 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#9578 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#10291 + # source://prism//lib/prism/node.rb#9563 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#10236 + # source://prism//lib/prism/node.rb#9510 sig { returns(Prism::Location) } def opening_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#10301 + # source://prism//lib/prism/node.rb#9573 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#10256 + # source://prism//lib/prism/node.rb#9542 sig { returns(Prism::Location) } def operator_loc; end # attr_reader receiver: Prism::node? # - # source://prism//lib/prism/node.rb#10220 + # source://prism//lib/prism/node.rb#9488 sig { returns(T.nilable(Prism::Node)) } def receiver; end @@ -16984,32 +18933,43 @@ class Prism::IndexOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10266 + # source://prism//lib/prism/node.rb#9468 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the call_operator_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#9505 + def save_call_operator_loc(repository); end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9534 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#9518 + def save_opening_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#9550 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#10351 + # source://prism//lib/prism/node.rb#9583 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#10263 + # source://prism//lib/prism/node.rb#9555 sig { returns(Prism::Node) } def value; end @@ -17017,27 +18977,14 @@ class Prism::IndexOrWriteNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10271 + # source://prism//lib/prism/node.rb#9473 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#10216 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10361 + # source://prism//lib/prism/node.rb#9588 def type; end end end @@ -17055,42 +19002,43 @@ end # for foo[bar] in baz do end # ^^^^^^^^ # -# source://prism//lib/prism/node.rb#10393 +# source://prism//lib/prism/node.rb#9620 class Prism::IndexTargetNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node receiver, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Location location) -> void + # Initialize a new IndexTargetNode node. # # @return [IndexTargetNode] a new instance of IndexTargetNode # - # source://prism//lib/prism/node.rb#10395 + # source://prism//lib/prism/node.rb#9622 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: Prism::Node, opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), - location: Prism::Location + block: T.nilable(Prism::BlockArgumentNode) ).void end - def initialize(source, flags, receiver, opening_loc, arguments, closing_loc, block, location); end + def initialize(source, node_id, location, flags, receiver, opening_loc, arguments, closing_loc, block); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#10555 + # source://prism//lib/prism/node.rb#9753 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#10408 + # source://prism//lib/prism/node.rb#9635 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/node.rb#10459 + # source://prism//lib/prism/node.rb#9708 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end @@ -17098,72 +19046,73 @@ class Prism::IndexTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10482 + # source://prism//lib/prism/node.rb#9682 sig { returns(T::Boolean) } def attribute_write?; end - # attr_reader block: Prism::node? + # attr_reader block: BlockArgumentNode? # - # source://prism//lib/prism/node.rb#10469 - sig { returns(T.nilable(Prism::Node)) } + # source://prism//lib/prism/node.rb#9724 + sig { returns(T.nilable(Prism::BlockArgumentNode)) } def block; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#10413 + # source://prism//lib/prism/node.rb#9640 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#10497 + # source://prism//lib/prism/node.rb#9732 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#10462 + # source://prism//lib/prism/node.rb#9711 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#10427 + # source://prism//lib/prism/node.rb#9654 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#10418 + # source://prism//lib/prism/node.rb#9645 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?location: Location) -> IndexTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode # - # source://prism//lib/prism/node.rb#10432 + # source://prism//lib/prism/node.rb#9659 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, receiver: Prism::Node, opening_loc: Prism::Location, arguments: T.nilable(Prism::ArgumentsNode), closing_loc: Prism::Location, - block: T.nilable(Prism::Node), - location: Prism::Location + block: T.nilable(Prism::BlockArgumentNode) ).returns(Prism::IndexTargetNode) end - def copy(flags: T.unsafe(nil), receiver: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#10413 + # source://prism//lib/prism/node.rb#9640 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, receiver: Prism::node, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: BlockArgumentNode? } # - # source://prism//lib/prism/node.rb#10440 + # source://prism//lib/prism/node.rb#9667 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -17174,31 +19123,31 @@ class Prism::IndexTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10487 + # source://prism//lib/prism/node.rb#9687 sig { returns(T::Boolean) } def ignore_visibility?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#10502 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#9737 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#10492 + # source://prism//lib/prism/node.rb#9727 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#10452 + # source://prism//lib/prism/node.rb#9695 sig { returns(Prism::Location) } def opening_loc; end # attr_reader receiver: Prism::node # - # source://prism//lib/prism/node.rb#10449 + # source://prism//lib/prism/node.rb#9692 sig { returns(Prism::Node) } def receiver; end @@ -17206,26 +19155,25 @@ class Prism::IndexTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10472 + # source://prism//lib/prism/node.rb#9672 sig { returns(T::Boolean) } def safe_navigation?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#9719 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#9703 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#10539 + # source://prism//lib/prism/node.rb#9742 sig { override.returns(Symbol) } def type; end @@ -17233,27 +19181,14 @@ class Prism::IndexTargetNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#10477 + # source://prism//lib/prism/node.rb#9677 sig { returns(T::Boolean) } def variable_call?; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#10445 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10549 + # source://prism//lib/prism/node.rb#9747 def type; end end end @@ -17261,11 +19196,11 @@ end # InlineComment objects are the most common. They correspond to comments in # the source file like this one that start with #. # -# source://prism//lib/prism/parse_result.rb#310 +# source://prism//lib/prism/parse_result.rb#546 class Prism::InlineComment < ::Prism::Comment # Returns a string representation of this comment. # - # source://prism//lib/prism/parse_result.rb#318 + # source://prism//lib/prism/parse_result.rb#554 sig { returns(String) } def inspect; end @@ -17274,7952 +19209,7751 @@ class Prism::InlineComment < ::Prism::Comment # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#313 + # source://prism//lib/prism/parse_result.rb#549 sig { override.returns(T::Boolean) } def trailing?; end end -# Represents the use of the `&&=` operator for assignment to an instance variable. +# This visitor is responsible for composing the strings that get returned by +# the various #inspect methods defined on each of the nodes. # -# @target &&= value -# ^^^^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#10570 -class Prism::InstanceVariableAndWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void +# source://prism//lib/prism/inspect_visitor.rb#12 +class Prism::InspectVisitor < ::Prism::Visitor + # Initializes a new instance of the InspectVisitor. # - # @return [InstanceVariableAndWriteNode] a new instance of InstanceVariableAndWriteNode + # @return [InspectVisitor] a new instance of InspectVisitor # - # source://prism//lib/prism/node.rb#10572 - sig do - params( - source: Prism::Source, - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).void - end - def initialize(source, name, name_loc, operator_loc, value, location); end + # source://prism//lib/prism/inspect_visitor.rb#35 + sig { params(indent: String).void } + def initialize(indent = T.unsafe(nil)); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # The list of commands that we need to execute in order to compose the + # final string. # - # source://prism//lib/prism/node.rb#10681 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#32 + def commands; end - # def accept: (Visitor visitor) -> void + # Compose the final string. # - # source://prism//lib/prism/node.rb#10583 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#48 + sig { returns(String) } + def compose; end - # def child_nodes: () -> Array[nil | Node] + # The current prefix string. # - # source://prism//lib/prism/node.rb#10588 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#28 + def indent; end - # def comment_targets: () -> Array[Node | Location] + # Inspect a AliasGlobalVariableNode node. # - # source://prism//lib/prism/node.rb#10598 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#77 + def visit_alias_global_variable_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a AliasMethodNode node. # - # source://prism//lib/prism/node.rb#10593 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#89 + def visit_alias_method_node(node); end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> InstanceVariableAndWriteNode + # Inspect a AlternationPatternNode node. # - # source://prism//lib/prism/node.rb#10603 - sig do - params( - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).returns(Prism::InstanceVariableAndWriteNode) - end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#101 + def visit_alternation_pattern_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a AndNode node. # - # source://prism//lib/prism/node.rb#10588 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#113 + def visit_and_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # Inspect a ArgumentsNode node. # - # source://prism//lib/prism/node.rb#10611 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#125 + def visit_arguments_node(node); end - # source://prism//lib/prism/desugar_compiler.rb#181 - def desugar; end + # Inspect a ArrayNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#141 + def visit_array_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a ArrayPatternNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#159 + def visit_array_pattern_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a AssocNode node. # - # source://prism//lib/prism/node.rb#10641 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#198 + def visit_assoc_node(node); end - # attr_reader name: Symbol + # Inspect a AssocSplatNode node. # - # source://prism//lib/prism/node.rb#10616 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#210 + def visit_assoc_splat_node(node); end - # attr_reader name_loc: Location + # Inspect a BackReferenceReadNode node. # - # source://prism//lib/prism/node.rb#10619 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/inspect_visitor.rb#224 + def visit_back_reference_read_node(node); end - # def operator: () -> String + # Inspect a BeginNode node. # - # source://prism//lib/prism/node.rb#10636 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/inspect_visitor.rb#232 + def visit_begin_node(node); end - # attr_reader operator_loc: Location + # Inspect a BlockArgumentNode node. # - # source://prism//lib/prism/node.rb#10626 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/inspect_visitor.rb#265 + def visit_block_argument_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a BlockLocalVariableNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#279 + def visit_block_local_variable_node(node); end + + # Inspect a BlockNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#287 + def visit_block_node(node); end + + # Inspect a BlockParameterNode node. # - # source://prism//lib/prism/node.rb#10665 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#309 + def visit_block_parameter_node(node); end - # attr_reader value: Prism::node + # Inspect a BlockParametersNode node. # - # source://prism//lib/prism/node.rb#10633 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/inspect_visitor.rb#323 + def visit_block_parameters_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10675 - def type; end - end -end + # Inspect a BreakNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#347 + def visit_break_node(node); end -# Represents assigning to an instance variable using an operator that isn't `=`. -# -# @target += value -# ^^^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#10694 -class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Symbol operator, Location location) -> void + # Inspect a CallAndWriteNode node. # - # @return [InstanceVariableOperatorWriteNode] a new instance of InstanceVariableOperatorWriteNode + # source://prism//lib/prism/inspect_visitor.rb#361 + def visit_call_and_write_node(node); end + + # Inspect a CallNode node. # - # source://prism//lib/prism/node.rb#10696 - sig do - params( - source: Prism::Source, - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - operator: Symbol, - location: Prism::Location - ).void - end - def initialize(source, name, name_loc, operator_loc, value, operator, location); end + # source://prism//lib/prism/inspect_visitor.rb#381 + def visit_call_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a CallOperatorWriteNode node. # - # source://prism//lib/prism/node.rb#10805 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#411 + def visit_call_operator_write_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a CallOrWriteNode node. # - # source://prism//lib/prism/node.rb#10708 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#432 + def visit_call_or_write_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a CallTargetNode node. # - # source://prism//lib/prism/node.rb#10713 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#452 + def visit_call_target_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a CapturePatternNode node. # - # source://prism//lib/prism/node.rb#10723 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#464 + def visit_capture_pattern_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a CaseMatchNode node. # - # source://prism//lib/prism/node.rb#10718 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#476 + def visit_case_match_node(node); end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?operator: Symbol, ?location: Location) -> InstanceVariableOperatorWriteNode + # Inspect a CaseNode node. # - # source://prism//lib/prism/node.rb#10728 - sig do - params( - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - operator: Symbol, - location: Prism::Location - ).returns(Prism::InstanceVariableOperatorWriteNode) - end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), operator: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#506 + def visit_case_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a ClassNode node. # - # source://prism//lib/prism/node.rb#10713 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#536 + def visit_class_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, operator: Symbol, location: Location } + # Inspect a ClassVariableAndWriteNode node. # - # source://prism//lib/prism/node.rb#10736 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#562 + def visit_class_variable_and_write_node(node); end - # source://prism//lib/prism/desugar_compiler.rb#193 - def desugar; end + # Inspect a ClassVariableOperatorWriteNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#574 + def visit_class_variable_operator_write_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a ClassVariableOrWriteNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#587 + def visit_class_variable_or_write_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a ClassVariableReadNode node. # - # source://prism//lib/prism/node.rb#10764 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#599 + def visit_class_variable_read_node(node); end - # attr_reader name: Symbol + # Inspect a ClassVariableTargetNode node. # - # source://prism//lib/prism/node.rb#10741 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#607 + def visit_class_variable_target_node(node); end - # attr_reader name_loc: Location + # Inspect a ClassVariableWriteNode node. # - # source://prism//lib/prism/node.rb#10744 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/inspect_visitor.rb#615 + def visit_class_variable_write_node(node); end - # attr_reader operator: Symbol + # Inspect a ConstantAndWriteNode node. # - # source://prism//lib/prism/node.rb#10761 - sig { returns(Symbol) } - def operator; end + # source://prism//lib/prism/inspect_visitor.rb#627 + def visit_constant_and_write_node(node); end - # attr_reader operator_loc: Location + # Inspect a ConstantOperatorWriteNode node. # - # source://prism//lib/prism/node.rb#10751 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/inspect_visitor.rb#639 + def visit_constant_operator_write_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a ConstantOrWriteNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#652 + def visit_constant_or_write_node(node); end + + # Inspect a ConstantPathAndWriteNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#664 + def visit_constant_path_and_write_node(node); end + + # Inspect a ConstantPathNode node. # - # source://prism//lib/prism/node.rb#10789 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#676 + def visit_constant_path_node(node); end - # attr_reader value: Prism::node + # Inspect a ConstantPathOperatorWriteNode node. # - # source://prism//lib/prism/node.rb#10758 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/inspect_visitor.rb#696 + def visit_constant_path_operator_write_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10799 - def type; end - end -end + # Inspect a ConstantPathOrWriteNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#709 + def visit_constant_path_or_write_node(node); end -# Represents the use of the `||=` operator for assignment to an instance variable. -# -# @target ||= value -# ^^^^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#10819 -class Prism::InstanceVariableOrWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Inspect a ConstantPathTargetNode node. # - # @return [InstanceVariableOrWriteNode] a new instance of InstanceVariableOrWriteNode + # source://prism//lib/prism/inspect_visitor.rb#721 + def visit_constant_path_target_node(node); end + + # Inspect a ConstantPathWriteNode node. # - # source://prism//lib/prism/node.rb#10821 - sig do - params( - source: Prism::Source, - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).void - end - def initialize(source, name, name_loc, operator_loc, value, location); end + # source://prism//lib/prism/inspect_visitor.rb#741 + def visit_constant_path_write_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a ConstantReadNode node. # - # source://prism//lib/prism/node.rb#10930 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#753 + def visit_constant_read_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a ConstantTargetNode node. # - # source://prism//lib/prism/node.rb#10832 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#761 + def visit_constant_target_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a ConstantWriteNode node. # - # source://prism//lib/prism/node.rb#10837 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#769 + def visit_constant_write_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a DefNode node. # - # source://prism//lib/prism/node.rb#10847 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#781 + def visit_def_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a DefinedNode node. # - # source://prism//lib/prism/node.rb#10842 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#815 + def visit_defined_node(node); end - # def copy: (?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> InstanceVariableOrWriteNode + # Inspect a ElseNode node. # - # source://prism//lib/prism/node.rb#10852 - sig do - params( - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).returns(Prism::InstanceVariableOrWriteNode) - end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#827 + def visit_else_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a EmbeddedStatementsNode node. # - # source://prism//lib/prism/node.rb#10837 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#842 + def visit_embedded_statements_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # Inspect a EmbeddedVariableNode node. # - # source://prism//lib/prism/node.rb#10860 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#857 + def visit_embedded_variable_node(node); end - # source://prism//lib/prism/desugar_compiler.rb#187 - def desugar; end + # Inspect a EnsureNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#867 + def visit_ensure_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a FalseNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#882 + def visit_false_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a FindPatternNode node. # - # source://prism//lib/prism/node.rb#10890 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#889 + def visit_find_pattern_node(node); end - # attr_reader name: Symbol + # Inspect a FlipFlopNode node. # - # source://prism//lib/prism/node.rb#10865 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#917 + def visit_flip_flop_node(node); end - # attr_reader name_loc: Location + # Inspect a FloatNode node. # - # source://prism//lib/prism/node.rb#10868 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/inspect_visitor.rb#937 + def visit_float_node(node); end - # def operator: () -> String + # Inspect a ForNode node. # - # source://prism//lib/prism/node.rb#10885 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/inspect_visitor.rb#945 + def visit_for_node(node); end - # attr_reader operator_loc: Location + # Inspect a ForwardingArgumentsNode node. # - # source://prism//lib/prism/node.rb#10875 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/inspect_visitor.rb#966 + def visit_forwarding_arguments_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a ForwardingParameterNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#973 + def visit_forwarding_parameter_node(node); end + + # Inspect a ForwardingSuperNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#980 + def visit_forwarding_super_node(node); end + + # Inspect a GlobalVariableAndWriteNode node. # - # source://prism//lib/prism/node.rb#10914 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#993 + def visit_global_variable_and_write_node(node); end - # attr_reader value: Prism::node + # Inspect a GlobalVariableOperatorWriteNode node. # - # source://prism//lib/prism/node.rb#10882 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/inspect_visitor.rb#1005 + def visit_global_variable_operator_write_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#10924 - def type; end - end -end + # Inspect a GlobalVariableOrWriteNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1018 + def visit_global_variable_or_write_node(node); end -# Represents referencing an instance variable. -# -# @foo -# ^^^^ -# -# source://prism//lib/prism/node.rb#10943 -class Prism::InstanceVariableReadNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Inspect a GlobalVariableReadNode node. # - # @return [InstanceVariableReadNode] a new instance of InstanceVariableReadNode + # source://prism//lib/prism/inspect_visitor.rb#1030 + def visit_global_variable_read_node(node); end + + # Inspect a GlobalVariableTargetNode node. # - # source://prism//lib/prism/node.rb#10945 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/inspect_visitor.rb#1038 + def visit_global_variable_target_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a GlobalVariableWriteNode node. # - # source://prism//lib/prism/node.rb#11029 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#1046 + def visit_global_variable_write_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a HashNode node. # - # source://prism//lib/prism/node.rb#10953 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#1058 + def visit_hash_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a HashPatternNode node. # - # source://prism//lib/prism/node.rb#10958 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1076 + def visit_hash_pattern_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a IfNode node. # - # source://prism//lib/prism/node.rb#10968 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#1106 + def visit_if_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a ImaginaryNode node. # - # source://prism//lib/prism/node.rb#10963 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1130 + def visit_imaginary_node(node); end - # def copy: (?name: Symbol, ?location: Location) -> InstanceVariableReadNode + # Inspect a ImplicitNode node. # - # source://prism//lib/prism/node.rb#10973 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::InstanceVariableReadNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1139 + def visit_implicit_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a ImplicitRestNode node. # - # source://prism//lib/prism/node.rb#10958 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#1148 + def visit_implicit_rest_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # Inspect a InNode node. # - # source://prism//lib/prism/node.rb#10981 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#1155 + def visit_in_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a IndexAndWriteNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1172 + def visit_index_and_write_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a IndexOperatorWriteNode node. # - # source://prism//lib/prism/node.rb#10993 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1203 + def visit_index_operator_write_node(node); end - # The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). + # Inspect a IndexOrWriteNode node. # - # @x # name `:@x` + # source://prism//lib/prism/inspect_visitor.rb#1235 + def visit_index_or_write_node(node); end + + # Inspect a IndexTargetNode node. # - # @_test # name `:@_test` + # source://prism//lib/prism/inspect_visitor.rb#1266 + def visit_index_target_node(node); end + + # Inspect a InstanceVariableAndWriteNode node. # - # source://prism//lib/prism/node.rb#10990 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#1289 + def visit_instance_variable_and_write_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a InstanceVariableOperatorWriteNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#1301 + def visit_instance_variable_operator_write_node(node); end + + # Inspect a InstanceVariableOrWriteNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#1314 + def visit_instance_variable_or_write_node(node); end + + # Inspect a InstanceVariableReadNode node. # - # source://prism//lib/prism/node.rb#11013 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#1326 + def visit_instance_variable_read_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#11023 - def type; end - end -end + # Inspect a InstanceVariableTargetNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1334 + def visit_instance_variable_target_node(node); end -# Represents writing to an instance variable in a context that doesn't have an explicit value. -# -# @foo, @bar = baz -# ^^^^ ^^^^ -# -# source://prism//lib/prism/node.rb#11039 -class Prism::InstanceVariableTargetNode < ::Prism::Node - # def initialize: (Symbol name, Location location) -> void + # Inspect a InstanceVariableWriteNode node. # - # @return [InstanceVariableTargetNode] a new instance of InstanceVariableTargetNode + # source://prism//lib/prism/inspect_visitor.rb#1342 + def visit_instance_variable_write_node(node); end + + # Inspect a IntegerNode node. # - # source://prism//lib/prism/node.rb#11041 - sig { params(source: Prism::Source, name: Symbol, location: Prism::Location).void } - def initialize(source, name, location); end + # source://prism//lib/prism/inspect_visitor.rb#1354 + def visit_integer_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a InterpolatedMatchLastLineNode node. # - # source://prism//lib/prism/node.rb#11121 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#1362 + def visit_interpolated_match_last_line_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a InterpolatedRegularExpressionNode node. # - # source://prism//lib/prism/node.rb#11049 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#1380 + def visit_interpolated_regular_expression_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a InterpolatedStringNode node. # - # source://prism//lib/prism/node.rb#11054 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1398 + def visit_interpolated_string_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a InterpolatedSymbolNode node. # - # source://prism//lib/prism/node.rb#11064 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#1416 + def visit_interpolated_symbol_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a InterpolatedXStringNode node. # - # source://prism//lib/prism/node.rb#11059 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1434 + def visit_interpolated_x_string_node(node); end - # def copy: (?name: Symbol, ?location: Location) -> InstanceVariableTargetNode + # Inspect a ItLocalVariableReadNode node. # - # source://prism//lib/prism/node.rb#11069 - sig { params(name: Symbol, location: Prism::Location).returns(Prism::InstanceVariableTargetNode) } - def copy(name: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1452 + def visit_it_local_variable_read_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a ItParametersNode node. # - # source://prism//lib/prism/node.rb#11054 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#1459 + def visit_it_parameters_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, location: Location } + # Inspect a KeywordHashNode node. # - # source://prism//lib/prism/node.rb#11077 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#1466 + def visit_keyword_hash_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a KeywordRestParameterNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1482 + def visit_keyword_rest_parameter_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a LambdaNode node. # - # source://prism//lib/prism/node.rb#11085 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1496 + def visit_lambda_node(node); end - # attr_reader name: Symbol + # Inspect a LocalVariableAndWriteNode node. # - # source://prism//lib/prism/node.rb#11082 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#1519 + def visit_local_variable_and_write_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a LocalVariableOperatorWriteNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#1532 + def visit_local_variable_operator_write_node(node); end + + # Inspect a LocalVariableOrWriteNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#1546 + def visit_local_variable_or_write_node(node); end + + # Inspect a LocalVariableReadNode node. # - # source://prism//lib/prism/node.rb#11105 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#1559 + def visit_local_variable_read_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#11115 - def type; end - end -end + # Inspect a LocalVariableTargetNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1568 + def visit_local_variable_target_node(node); end -# Represents writing to an instance variable. -# -# @foo = 1 -# ^^^^^^^^ -# -# source://prism//lib/prism/node.rb#11131 -class Prism::InstanceVariableWriteNode < ::Prism::Node - # def initialize: (Symbol name, Location name_loc, Prism::node value, Location operator_loc, Location location) -> void + # Inspect a LocalVariableWriteNode node. # - # @return [InstanceVariableWriteNode] a new instance of InstanceVariableWriteNode + # source://prism//lib/prism/inspect_visitor.rb#1577 + def visit_local_variable_write_node(node); end + + # Inspect a MatchLastLineNode node. # - # source://prism//lib/prism/node.rb#11133 - sig do - params( - source: Prism::Source, - name: Symbol, - name_loc: Prism::Location, - value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).void - end - def initialize(source, name, name_loc, value, operator_loc, location); end + # source://prism//lib/prism/inspect_visitor.rb#1590 + def visit_match_last_line_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a MatchPredicateNode node. # - # source://prism//lib/prism/node.rb#11258 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#1601 + def visit_match_predicate_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a MatchRequiredNode node. # - # source://prism//lib/prism/node.rb#11144 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#1613 + def visit_match_required_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a MatchWriteNode node. # - # source://prism//lib/prism/node.rb#11149 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1625 + def visit_match_write_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a MissingNode node. # - # source://prism//lib/prism/node.rb#11159 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#1643 + def visit_missing_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a ModuleNode node. # - # source://prism//lib/prism/node.rb#11154 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#1650 + def visit_module_node(node); end - # def copy: (?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location, ?location: Location) -> InstanceVariableWriteNode + # Inspect a MultiTargetNode node. # - # source://prism//lib/prism/node.rb#11164 - sig do - params( - name: Symbol, - name_loc: Prism::Location, - value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::InstanceVariableWriteNode) - end - def copy(name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1669 + def visit_multi_target_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a MultiWriteNode node. # - # source://prism//lib/prism/node.rb#11149 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#1702 + def visit_multi_write_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location, location: Location } + # Inspect a NextNode node. # - # source://prism//lib/prism/node.rb#11172 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end - - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # source://prism//lib/prism/inspect_visitor.rb#1738 + def visit_next_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a NilNode node. # - # source://prism//lib/prism/node.rb#11218 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#1752 + def visit_nil_node(node); end - # The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). - # - # @x = :y # name `:@x` + # Inspect a NoKeywordsParameterNode node. # - # @_foo = "bar" # name `@_foo` + # source://prism//lib/prism/inspect_visitor.rb#1759 + def visit_no_keywords_parameter_node(node); end + + # Inspect a NumberedParametersNode node. # - # source://prism//lib/prism/node.rb#11181 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/inspect_visitor.rb#1768 + def visit_numbered_parameters_node(node); end - # The location of the variable name. + # Inspect a NumberedReferenceReadNode node. # - # @_x = 1 - # ^^^ + # source://prism//lib/prism/inspect_visitor.rb#1776 + def visit_numbered_reference_read_node(node); end + + # Inspect a OptionalKeywordParameterNode node. # - # source://prism//lib/prism/node.rb#11187 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/inspect_visitor.rb#1784 + def visit_optional_keyword_parameter_node(node); end - # def operator: () -> String + # Inspect a OptionalParameterNode node. # - # source://prism//lib/prism/node.rb#11213 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/inspect_visitor.rb#1795 + def visit_optional_parameter_node(node); end - # The location of the `=` operator. + # Inspect a OrNode node. # - # @x = y - # ^ + # source://prism//lib/prism/inspect_visitor.rb#1807 + def visit_or_node(node); end + + # Inspect a ParametersNode node. # - # source://prism//lib/prism/node.rb#11206 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/inspect_visitor.rb#1819 + def visit_parameters_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a ParenthesesNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#1880 + def visit_parentheses_node(node); end + + # Inspect a PinnedExpressionNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#1895 + def visit_pinned_expression_node(node); end + + # Inspect a PinnedVariableNode node. # - # source://prism//lib/prism/node.rb#11242 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#1907 + def visit_pinned_variable_node(node); end - # The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # Inspect a PostExecutionNode node. # - # @foo = :bar - # ^^^^ + # source://prism//lib/prism/inspect_visitor.rb#1917 + def visit_post_execution_node(node); end + + # Inspect a PreExecutionNode node. # - # @_x = 1234 - # ^^^^ + # source://prism//lib/prism/inspect_visitor.rb#1933 + def visit_pre_execution_node(node); end + + # Inspect a ProgramNode node. # - # source://prism//lib/prism/node.rb#11200 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/inspect_visitor.rb#1949 + def visit_program_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#11252 - def type; end - end -end + # Inspect a RangeNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1959 + def visit_range_node(node); end -# Flags for integer nodes that correspond to the base of the integer. -# -# source://prism//lib/prism/node.rb#20373 -module Prism::IntegerBaseFlags; end + # Inspect a RationalNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1979 + def visit_rational_node(node); end -# 0b prefix -# -# source://prism//lib/prism/node.rb#20375 -Prism::IntegerBaseFlags::BINARY = T.let(T.unsafe(nil), Integer) + # Inspect a RedoNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1988 + def visit_redo_node(node); end -# 0d or no prefix -# -# source://prism//lib/prism/node.rb#20378 -Prism::IntegerBaseFlags::DECIMAL = T.let(T.unsafe(nil), Integer) + # Inspect a RegularExpressionNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#1995 + def visit_regular_expression_node(node); end -# 0x prefix -# -# source://prism//lib/prism/node.rb#20384 -Prism::IntegerBaseFlags::HEXADECIMAL = T.let(T.unsafe(nil), Integer) + # Inspect a RequiredKeywordParameterNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#2006 + def visit_required_keyword_parameter_node(node); end -# 0o or 0 prefix -# -# source://prism//lib/prism/node.rb#20381 -Prism::IntegerBaseFlags::OCTAL = T.let(T.unsafe(nil), Integer) + # Inspect a RequiredParameterNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#2015 + def visit_required_parameter_node(node); end -# Represents an integer number literal. -# -# 1 -# ^ -# -# source://prism//lib/prism/node.rb#11271 -class Prism::IntegerNode < ::Prism::Node - # def initialize: (Integer flags, Integer value, Location location) -> void + # Inspect a RescueModifierNode node. # - # @return [IntegerNode] a new instance of IntegerNode + # source://prism//lib/prism/inspect_visitor.rb#2023 + def visit_rescue_modifier_node(node); end + + # Inspect a RescueNode node. # - # source://prism//lib/prism/node.rb#11273 - sig { params(source: Prism::Source, flags: Integer, value: Integer, location: Prism::Location).void } - def initialize(source, flags, value, location); end + # source://prism//lib/prism/inspect_visitor.rb#2035 + def visit_rescue_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Inspect a RestParameterNode node. # - # source://prism//lib/prism/node.rb#11380 - def ===(other); end + # source://prism//lib/prism/inspect_visitor.rb#2072 + def visit_rest_parameter_node(node); end - # def accept: (Visitor visitor) -> void + # Inspect a RetryNode node. # - # source://prism//lib/prism/node.rb#11282 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/inspect_visitor.rb#2086 + def visit_retry_node(node); end - # def binary?: () -> bool + # Inspect a ReturnNode node. # - # @return [Boolean] + # source://prism//lib/prism/inspect_visitor.rb#2093 + def visit_return_node(node); end + + # Inspect a SelfNode node. # - # source://prism//lib/prism/node.rb#11322 - sig { returns(T::Boolean) } - def binary?; end + # source://prism//lib/prism/inspect_visitor.rb#2107 + def visit_self_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Inspect a ShareableConstantNode node. # - # source://prism//lib/prism/node.rb#11287 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#2114 + def visit_shareable_constant_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Inspect a SingletonClassNode node. # - # source://prism//lib/prism/node.rb#11297 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/inspect_visitor.rb#2123 + def visit_singleton_class_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Inspect a SourceEncodingNode node. # - # source://prism//lib/prism/node.rb#11292 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/inspect_visitor.rb#2142 + def visit_source_encoding_node(node); end - # def copy: (?flags: Integer, ?value: Integer, ?location: Location) -> IntegerNode + # Inspect a SourceFileNode node. # - # source://prism//lib/prism/node.rb#11302 - sig { params(flags: Integer, value: Integer, location: Prism::Location).returns(Prism::IntegerNode) } - def copy(flags: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#2149 + def visit_source_file_node(node); end - # def decimal?: () -> bool + # Inspect a SourceLineNode node. # - # @return [Boolean] + # source://prism//lib/prism/inspect_visitor.rb#2157 + def visit_source_line_node(node); end + + # Inspect a SplatNode node. # - # source://prism//lib/prism/node.rb#11327 - sig { returns(T::Boolean) } - def decimal?; end + # source://prism//lib/prism/inspect_visitor.rb#2164 + def visit_splat_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Inspect a StatementsNode node. # - # source://prism//lib/prism/node.rb#11287 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/inspect_visitor.rb#2178 + def visit_statements_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, value: Integer, location: Location } + # Inspect a StringNode node. # - # source://prism//lib/prism/node.rb#11310 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/inspect_visitor.rb#2194 + def visit_string_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Inspect a SuperNode node. + # + # source://prism//lib/prism/inspect_visitor.rb#2205 + def visit_super_node(node); end - # def hexadecimal?: () -> bool + # Inspect a SymbolNode node. # - # @return [Boolean] + # source://prism//lib/prism/inspect_visitor.rb#2227 + def visit_symbol_node(node); end + + # Inspect a TrueNode node. # - # source://prism//lib/prism/node.rb#11337 - sig { returns(T::Boolean) } - def hexadecimal?; end + # source://prism//lib/prism/inspect_visitor.rb#2238 + def visit_true_node(node); end - # def inspect(NodeInspector inspector) -> String + # Inspect a UndefNode node. # - # source://prism//lib/prism/node.rb#11342 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/inspect_visitor.rb#2245 + def visit_undef_node(node); end - # def octal?: () -> bool + # Inspect a UnlessNode node. # - # @return [Boolean] + # source://prism//lib/prism/inspect_visitor.rb#2262 + def visit_unless_node(node); end + + # Inspect a UntilNode node. # - # source://prism//lib/prism/node.rb#11332 - sig { returns(T::Boolean) } - def octal?; end + # source://prism//lib/prism/inspect_visitor.rb#2286 + def visit_until_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Inspect a WhenNode node. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/inspect_visitor.rb#2304 + def visit_when_node(node); end + + # Inspect a WhileNode node. # - # def type: () -> Symbol + # source://prism//lib/prism/inspect_visitor.rb#2328 + def visit_while_node(node); end + + # Inspect a XStringNode node. # - # source://prism//lib/prism/node.rb#11364 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/inspect_visitor.rb#2346 + def visit_x_string_node(node); end - # The value of the integer literal as a number. + # Inspect a YieldNode node. # - # source://prism//lib/prism/node.rb#11319 - sig { returns(Integer) } - def value; end + # source://prism//lib/prism/inspect_visitor.rb#2357 + def visit_yield_node(node); end - protected + private - # protected attr_reader flags: Integer + # Compose a string representing the given inner location field. # - # source://prism//lib/prism/node.rb#11315 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/inspect_visitor.rb#2381 + def inspect_location(location); end + + # Compose a header for the given node. + # + # source://prism//lib/prism/inspect_visitor.rb#2375 + def inspect_node(name, node); end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Compose an inspect string for the given node. # - # source://prism//lib/prism/node.rb#11374 - def type; end + # source://prism//lib/prism/inspect_visitor.rb#41 + sig { params(node: Prism::Node).returns(String) } + def compose(node); end end end -# Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object. +# Most of the time, we can simply pass down the indent to the next node. +# However, when we are inside a list we want some extra special formatting +# when we hit an element in that list. In this case, we have a special +# command that replaces the subsequent indent with the given value. # -# if /foo #{bar} baz/ then end -# ^^^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#11391 -class Prism::InterpolatedMatchLastLineNode < ::Prism::Node - include ::Prism::RegularExpressionOptions +# source://prism//lib/prism/inspect_visitor.rb#17 +class Prism::InspectVisitor::Replace + # @return [Replace] a new instance of Replace + # + # source://prism//lib/prism/inspect_visitor.rb#20 + def initialize(value); end + + # source://prism//lib/prism/inspect_visitor.rb#18 + def value; end +end - # def initialize: (Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc, Location location) -> void +# Represents the use of the `&&=` operator for assignment to an instance variable. +# +# @target &&= value +# ^^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#9768 +class Prism::InstanceVariableAndWriteNode < ::Prism::Node + # Initialize a new InstanceVariableAndWriteNode node. # - # @return [InterpolatedMatchLastLineNode] a new instance of InterpolatedMatchLastLineNode + # @return [InstanceVariableAndWriteNode] a new instance of InstanceVariableAndWriteNode # - # source://prism//lib/prism/node.rb#11393 + # source://prism//lib/prism/node.rb#9770 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node ).void end - def initialize(source, flags, opening_loc, parts, closing_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#11568 + # source://prism//lib/prism/node.rb#9868 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#11404 + # source://prism//lib/prism/node.rb#9782 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # def ascii_8bit?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11488 - sig { returns(T::Boolean) } - def ascii_8bit?; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11414 + # source://prism//lib/prism/node.rb#9787 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#11523 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#11456 - sig { returns(Prism::Location) } - def closing_loc; end - - # def comment_targets: () -> Array[Node | Location] - # - # source://prism//lib/prism/node.rb#11424 + # source://prism//lib/prism/node.rb#9797 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#11419 + # source://prism//lib/prism/node.rb#9792 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location, ?location: Location) -> InterpolatedMatchLastLineNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode # - # source://prism//lib/prism/node.rb#11429 + # source://prism//lib/prism/node.rb#9802 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::InterpolatedMatchLastLineNode) + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableAndWriteNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11414 + # source://prism//lib/prism/node.rb#9787 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#11437 + # source://prism//lib/prism/node.rb#9810 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def euc_jp?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11483 - sig { returns(T::Boolean) } - def euc_jp?; end - - # def extended?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11468 - sig { returns(T::Boolean) } - def extended?; end + # source://prism//lib/prism/desugar_compiler.rb#218 + def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def forced_binary_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11508 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end - - # def forced_us_ascii_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11513 - sig { returns(T::Boolean) } - def forced_us_ascii_encoding?; end - - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11503 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end - - # def ignore_case?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11463 - sig { returns(T::Boolean) } - def ignore_case?; end - - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#11528 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#9852 + sig { override.returns(String) } + def inspect; end - # def multi_line?: () -> bool - # - # @return [Boolean] + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#11473 - sig { returns(T::Boolean) } - def multi_line?; end + # source://prism//lib/prism/node.rb#9815 + sig { returns(Symbol) } + def name; end - # def once?: () -> bool - # - # @return [Boolean] + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#11478 - sig { returns(T::Boolean) } - def once?; end + # source://prism//lib/prism/node.rb#9818 + sig { returns(Prism::Location) } + def name_loc; end - # def opening: () -> String + # def operator: () -> String # - # source://prism//lib/prism/node.rb#11518 + # source://prism//lib/prism/node.rb#9847 sig { returns(String) } - def opening; end + def operator; end - # attr_reader opening_loc: Location + # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#11446 + # source://prism//lib/prism/node.rb#9831 sig { returns(Prism::Location) } - def opening_loc; end - - sig { returns(Integer) } - def options; end + def operator_loc; end - # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#11453 - sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } - def parts; end - - # source://prism//lib/prism/node.rb#11408 - def set_newline_flag(newline_marked); end + # source://prism//lib/prism/node.rb#9826 + def save_name_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#9839 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#11552 + # source://prism//lib/prism/node.rb#9857 sig { override.returns(Symbol) } def type; end - # def utf_8?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11498 - sig { returns(T::Boolean) } - def utf_8?; end - - # def windows_31j?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11493 - sig { returns(T::Boolean) } - def windows_31j?; end - - protected - - # protected attr_reader flags: Integer + # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#11442 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#9844 + sig { returns(Prism::Node) } + def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#11562 + # source://prism//lib/prism/node.rb#9862 def type; end end end -# Represents a regular expression literal that contains interpolation. +# Represents assigning to an instance variable using an operator that isn't `=`. # -# /foo #{bar} baz/ +# @target += value # ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#11582 -class Prism::InterpolatedRegularExpressionNode < ::Prism::Node - include ::Prism::RegularExpressionOptions - - # def initialize: (Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc, Location location) -> void +# source://prism//lib/prism/node.rb#9881 +class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node + # Initialize a new InstanceVariableOperatorWriteNode node. # - # @return [InterpolatedRegularExpressionNode] a new instance of InterpolatedRegularExpressionNode + # @return [InstanceVariableOperatorWriteNode] a new instance of InstanceVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#11584 + # source://prism//lib/prism/node.rb#9883 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol ).void end - def initialize(source, flags, opening_loc, parts, closing_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#11759 + # source://prism//lib/prism/node.rb#9980 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#11595 + # source://prism//lib/prism/node.rb#9896 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # def ascii_8bit?: () -> bool + # attr_reader binary_operator: Symbol # - # @return [Boolean] + # source://prism//lib/prism/node.rb#9961 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location # - # source://prism//lib/prism/node.rb#11679 - sig { returns(T::Boolean) } - def ascii_8bit?; end + # source://prism//lib/prism/node.rb#9945 + sig { returns(Prism::Location) } + def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11605 + # source://prism//lib/prism/node.rb#9901 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String - # - # source://prism//lib/prism/node.rb#11714 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#11647 - sig { returns(Prism::Location) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#11615 + # source://prism//lib/prism/node.rb#9911 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#11610 + # source://prism//lib/prism/node.rb#9906 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location, ?location: Location) -> InterpolatedRegularExpressionNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#11620 + # source://prism//lib/prism/node.rb#9916 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::InterpolatedRegularExpressionNode) + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::InstanceVariableOperatorWriteNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11605 + # source://prism//lib/prism/node.rb#9901 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # - # source://prism//lib/prism/node.rb#11628 + # source://prism//lib/prism/node.rb#9924 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def euc_jp?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11674 - sig { returns(T::Boolean) } - def euc_jp?; end - - # def extended?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11659 - sig { returns(T::Boolean) } - def extended?; end + # source://prism//lib/prism/desugar_compiler.rb#230 + def desugar; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def forced_binary_encoding?: () -> bool - # - # @return [Boolean] + # def inspect -> String # - # source://prism//lib/prism/node.rb#11699 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end + # source://prism//lib/prism/node.rb#9964 + sig { override.returns(String) } + def inspect; end - # def forced_us_ascii_encoding?: () -> bool - # - # @return [Boolean] + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#11704 - sig { returns(T::Boolean) } - def forced_us_ascii_encoding?; end + # source://prism//lib/prism/node.rb#9929 + sig { returns(Symbol) } + def name; end - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#11694 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end + # source://prism//lib/prism/node.rb#9932 + sig { returns(Prism::Location) } + def name_loc; end - # def ignore_case?: () -> bool + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11654 - sig { returns(T::Boolean) } - def ignore_case?; end + # source://prism//lib/prism/node_ext.rb#435 + def operator; end - # def inspect(NodeInspector inspector) -> String + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # source://prism//lib/prism/node.rb#11719 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node_ext.rb#442 + def operator_loc; end - # def multi_line?: () -> bool + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11664 - sig { returns(T::Boolean) } - def multi_line?; end + # source://prism//lib/prism/node.rb#9953 + def save_binary_operator_loc(repository); end - # def once?: () -> bool - # - # @return [Boolean] + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#11669 - sig { returns(T::Boolean) } - def once?; end + # source://prism//lib/prism/node.rb#9940 + def save_name_loc(repository); end - # def opening: () -> String + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#11709 - sig { returns(String) } - def opening; end + # source://prism//lib/prism/node.rb#9969 + sig { override.returns(Symbol) } + def type; end - # attr_reader opening_loc: Location + # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#11637 - sig { returns(Prism::Location) } - def opening_loc; end + # source://prism//lib/prism/node.rb#9958 + sig { returns(Prism::Node) } + def value; end - sig { returns(Integer) } - def options; end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#9974 + def type; end + end +end - # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] - # - # source://prism//lib/prism/node.rb#11644 - sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } - def parts; end - - # source://prism//lib/prism/node.rb#11599 - def set_newline_flag(newline_marked); end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#11743 - sig { override.returns(Symbol) } - def type; end - - # def utf_8?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11689 - sig { returns(T::Boolean) } - def utf_8?; end - - # def windows_31j?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#11684 - sig { returns(T::Boolean) } - def windows_31j?; end - - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#11633 - sig { returns(Integer) } - def flags; end - - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#11753 - def type; end - end -end - -# Represents a string literal that contains interpolation. +# Represents the use of the `||=` operator for assignment to an instance variable. # -# "foo #{bar} baz" -# ^^^^^^^^^^^^^^^^ +# @target ||= value +# ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#11773 -class Prism::InterpolatedStringNode < ::Prism::Node - include ::Prism::HeredocQuery - - # def initialize: (Integer flags, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] parts, Location? closing_loc, Location location) -> void +# source://prism//lib/prism/node.rb#9994 +class Prism::InstanceVariableOrWriteNode < ::Prism::Node + # Initialize a new InstanceVariableOrWriteNode node. # - # @return [InterpolatedStringNode] a new instance of InterpolatedStringNode + # @return [InstanceVariableOrWriteNode] a new instance of InstanceVariableOrWriteNode # - # source://prism//lib/prism/node.rb#11775 + # source://prism//lib/prism/node.rb#9996 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode)], - closing_loc: T.nilable(Prism::Location), - location: Prism::Location + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node ).void end - def initialize(source, flags, opening_loc, parts, closing_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#11917 + # source://prism//lib/prism/node.rb#10094 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#11786 + # source://prism//lib/prism/node.rb#10008 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11796 + # source://prism//lib/prism/node.rb#10013 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String? - # - # source://prism//lib/prism/node.rb#11872 - sig { returns(T.nilable(String)) } - def closing; end - - # attr_reader closing_loc: Location? - # - # source://prism//lib/prism/node.rb#11844 - sig { returns(T.nilable(Prism::Location)) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#11806 + # source://prism//lib/prism/node.rb#10023 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#11801 + # source://prism//lib/prism/node.rb#10018 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?, ?location: Location) -> InterpolatedStringNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode # - # source://prism//lib/prism/node.rb#11811 + # source://prism//lib/prism/node.rb#10028 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode)], - closing_loc: T.nilable(Prism::Location), - location: Prism::Location - ).returns(Prism::InterpolatedStringNode) + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableOrWriteNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11796 + # source://prism//lib/prism/node.rb#10013 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#11819 + # source://prism//lib/prism/node.rb#10036 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # source://prism//lib/prism/desugar_compiler.rb#224 + def desugar; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def frozen?: () -> bool - # - # @return [Boolean] + # def inspect -> String # - # source://prism//lib/prism/node.rb#11857 - sig { returns(T::Boolean) } - def frozen?; end - - sig { returns(T::Boolean) } - def heredoc?; end + # source://prism//lib/prism/node.rb#10078 + sig { override.returns(String) } + def inspect; end - # def inspect(NodeInspector inspector) -> String + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#11877 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#10041 + sig { returns(Symbol) } + def name; end - # def mutable?: () -> bool - # - # @return [Boolean] + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#11862 - sig { returns(T::Boolean) } - def mutable?; end + # source://prism//lib/prism/node.rb#10044 + sig { returns(Prism::Location) } + def name_loc; end - # def opening: () -> String? + # def operator: () -> String # - # source://prism//lib/prism/node.rb#11867 - sig { returns(T.nilable(String)) } - def opening; end + # source://prism//lib/prism/node.rb#10073 + sig { returns(String) } + def operator; end - # attr_reader opening_loc: Location? + # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#11828 - sig { returns(T.nilable(Prism::Location)) } - def opening_loc; end + # source://prism//lib/prism/node.rb#10057 + sig { returns(Prism::Location) } + def operator_loc; end - # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#11841 - sig do - returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode)]) - end - def parts; end + # source://prism//lib/prism/node.rb#10052 + def save_name_loc(repository); end - # source://prism//lib/prism/node.rb#11790 - def set_newline_flag(newline_marked); end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#10065 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#11901 + # source://prism//lib/prism/node.rb#10083 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer + # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#11824 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#10070 + sig { returns(Prism::Node) } + def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#11911 + # source://prism//lib/prism/node.rb#10088 def type; end end end -# Flags for interpolated string nodes that indicated mutability if they are also marked as literals. -# -# source://prism//lib/prism/node.rb#20388 -module Prism::InterpolatedStringNodeFlags; end - -# source://prism//lib/prism/node.rb#20390 -Prism::InterpolatedStringNodeFlags::FROZEN = T.let(T.unsafe(nil), Integer) - -# source://prism//lib/prism/node.rb#20393 -Prism::InterpolatedStringNodeFlags::MUTABLE = T.let(T.unsafe(nil), Integer) - -# Represents a symbol literal that contains interpolation. +# Represents referencing an instance variable. # -# :"foo #{bar} baz" -# ^^^^^^^^^^^^^^^^^ +# @foo +# ^^^^ # -# source://prism//lib/prism/node.rb#11931 -class Prism::InterpolatedSymbolNode < ::Prism::Node - # def initialize: (Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location? closing_loc, Location location) -> void +# source://prism//lib/prism/node.rb#10107 +class Prism::InstanceVariableReadNode < ::Prism::Node + # Initialize a new InstanceVariableReadNode node. # - # @return [InterpolatedSymbolNode] a new instance of InterpolatedSymbolNode + # @return [InstanceVariableReadNode] a new instance of InstanceVariableReadNode # - # source://prism//lib/prism/node.rb#11933 - sig do - params( - source: Prism::Source, - opening_loc: T.nilable(Prism::Location), - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: T.nilable(Prism::Location), - location: Prism::Location - ).void - end - def initialize(source, opening_loc, parts, closing_loc, location); end + # source://prism//lib/prism/node.rb#10109 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12058 + # source://prism//lib/prism/node.rb#10174 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#11943 + # source://prism//lib/prism/node.rb#10118 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11953 + # source://prism//lib/prism/node.rb#10123 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String? - # - # source://prism//lib/prism/node.rb#12015 - sig { returns(T.nilable(String)) } - def closing; end - - # attr_reader closing_loc: Location? - # - # source://prism//lib/prism/node.rb#11997 - sig { returns(T.nilable(Prism::Location)) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#11963 + # source://prism//lib/prism/node.rb#10133 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#11958 + # source://prism//lib/prism/node.rb#10128 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?, ?location: Location) -> InterpolatedSymbolNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode # - # source://prism//lib/prism/node.rb#11968 + # source://prism//lib/prism/node.rb#10138 sig do params( - opening_loc: T.nilable(Prism::Location), - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: T.nilable(Prism::Location), - location: Prism::Location - ).returns(Prism::InterpolatedSymbolNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableReadNode) end - def copy(opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#11953 + # source://prism//lib/prism/node.rb#10123 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#11976 + # source://prism//lib/prism/node.rb#10146 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#12020 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#10158 + sig { override.returns(String) } + def inspect; end - # def opening: () -> String? + # The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # - # source://prism//lib/prism/node.rb#12010 - sig { returns(T.nilable(String)) } - def opening; end - - # attr_reader opening_loc: Location? + # @x # name `:@x` # - # source://prism//lib/prism/node.rb#11981 - sig { returns(T.nilable(Prism::Location)) } - def opening_loc; end - - # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] + # @_test # name `:@_test` # - # source://prism//lib/prism/node.rb#11994 - sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } - def parts; end - - # source://prism//lib/prism/node.rb#11947 - def set_newline_flag(newline_marked); end + # source://prism//lib/prism/node.rb#10155 + sig { returns(Symbol) } + def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#12042 + # source://prism//lib/prism/node.rb#10163 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12052 + # source://prism//lib/prism/node.rb#10168 def type; end end end -# Represents an xstring literal that contains interpolation. +# Represents writing to an instance variable in a context that doesn't have an explicit value. # -# `foo #{bar} baz` -# ^^^^^^^^^^^^^^^^ +# @foo, @bar = baz +# ^^^^ ^^^^ # -# source://prism//lib/prism/node.rb#12071 -class Prism::InterpolatedXStringNode < ::Prism::Node - include ::Prism::HeredocQuery +# source://prism//lib/prism/node.rb#10184 +class Prism::InstanceVariableTargetNode < ::Prism::Node + # Initialize a new InstanceVariableTargetNode node. + # + # @return [InstanceVariableTargetNode] a new instance of InstanceVariableTargetNode + # + # source://prism//lib/prism/node.rb#10186 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end - # def initialize: (Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc, Location location) -> void + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # @return [InterpolatedXStringNode] a new instance of InterpolatedXStringNode + # source://prism//lib/prism/node.rb#10247 + def ===(other); end + + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12073 - sig do - params( - source: Prism::Source, - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location - ).void - end - def initialize(source, opening_loc, parts, closing_loc, location); end - - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. - # - # source://prism//lib/prism/node.rb#12186 - def ===(other); end - - # def accept: (Visitor visitor) -> void - # - # source://prism//lib/prism/node.rb#12083 + # source://prism//lib/prism/node.rb#10195 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12093 + # source://prism//lib/prism/node.rb#10200 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String - # - # source://prism//lib/prism/node.rb#12143 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#12131 - sig { returns(Prism::Location) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12103 + # source://prism//lib/prism/node.rb#10210 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12098 + # source://prism//lib/prism/node.rb#10205 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location, ?location: Location) -> InterpolatedXStringNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode # - # source://prism//lib/prism/node.rb#12108 + # source://prism//lib/prism/node.rb#10215 sig do params( - opening_loc: Prism::Location, - parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::InterpolatedXStringNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableTargetNode) end - def copy(opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12093 + # source://prism//lib/prism/node.rb#10200 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#12116 + # source://prism//lib/prism/node.rb#10223 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - sig { returns(T::Boolean) } - def heredoc?; end - - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#12148 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def opening: () -> String - # - # source://prism//lib/prism/node.rb#12138 - sig { returns(String) } - def opening; end - - # attr_reader opening_loc: Location + # def inspect -> String # - # source://prism//lib/prism/node.rb#12121 - sig { returns(Prism::Location) } - def opening_loc; end + # source://prism//lib/prism/node.rb#10231 + sig { override.returns(String) } + def inspect; end - # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#12128 - sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } - def parts; end - - # source://prism//lib/prism/node.rb#12087 - def set_newline_flag(newline_marked); end + # source://prism//lib/prism/node.rb#10228 + sig { returns(Symbol) } + def name; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#12170 + # source://prism//lib/prism/node.rb#10236 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#12180 + # source://prism//lib/prism/node.rb#10241 def type; end end end -# Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda. +# Represents writing to an instance variable. # -# -> { it + it } -# ^^^^^^^^^^^^^^ +# @foo = 1 +# ^^^^^^^^ # -# source://prism//lib/prism/node.rb#12199 -class Prism::ItParametersNode < ::Prism::Node - # def initialize: (Location location) -> void +# source://prism//lib/prism/node.rb#10257 +class Prism::InstanceVariableWriteNode < ::Prism::Node + # Initialize a new InstanceVariableWriteNode node. # - # @return [ItParametersNode] a new instance of ItParametersNode + # @return [InstanceVariableWriteNode] a new instance of InstanceVariableWriteNode # - # source://prism//lib/prism/node.rb#12201 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#10259 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12276 + # source://prism//lib/prism/node.rb#10373 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12208 + # source://prism//lib/prism/node.rb#10271 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12213 + # source://prism//lib/prism/node.rb#10276 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12223 + # source://prism//lib/prism/node.rb#10286 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12218 + # source://prism//lib/prism/node.rb#10281 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> ItParametersNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode # - # source://prism//lib/prism/node.rb#12228 - sig { params(location: Prism::Location).returns(Prism::ItParametersNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#10291 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::InstanceVariableWriteNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12213 + # source://prism//lib/prism/node.rb#10276 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#12236 + # source://prism//lib/prism/node.rb#10299 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#12241 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#10357 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @x = :y # name `:@x` + # + # @_foo = "bar" # name `@_foo` + # + # source://prism//lib/prism/node.rb#10308 + sig { returns(Symbol) } + def name; end + + # The location of the variable name. + # + # @_x = 1 + # ^^^ + # + # source://prism//lib/prism/node.rb#10314 + sig { returns(Prism::Location) } + def name_loc; end + + # def operator: () -> String + # + # source://prism//lib/prism/node.rb#10352 + sig { returns(String) } + def operator; end + + # The location of the `=` operator. + # + # @x = y + # ^ + # + # source://prism//lib/prism/node.rb#10339 + sig { returns(Prism::Location) } + def operator_loc; end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#10322 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#10347 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#12260 + # source://prism//lib/prism/node.rb#10362 sig { override.returns(Symbol) } def type; end + # The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # @foo = :bar + # ^^^^ + # + # @_x = 1234 + # ^^^^ + # + # source://prism//lib/prism/node.rb#10333 + sig { returns(Prism::Node) } + def value; end + class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12270 + # source://prism//lib/prism/node.rb#10367 def type; end end end -# Represents a hash literal without opening and closing braces. +# Flags for integer nodes that correspond to the base of the integer. # -# foo(a: b) -# ^^^^ +# source://prism//lib/prism/node.rb#18507 +module Prism::IntegerBaseFlags; end + +# 0b prefix # -# source://prism//lib/prism/node.rb#12285 -class Prism::KeywordHashNode < ::Prism::Node - # def initialize: (Integer flags, Array[AssocNode | AssocSplatNode] elements, Location location) -> void +# source://prism//lib/prism/node.rb#18509 +Prism::IntegerBaseFlags::BINARY = T.let(T.unsafe(nil), Integer) + +# 0d or no prefix +# +# source://prism//lib/prism/node.rb#18512 +Prism::IntegerBaseFlags::DECIMAL = T.let(T.unsafe(nil), Integer) + +# 0x prefix +# +# source://prism//lib/prism/node.rb#18518 +Prism::IntegerBaseFlags::HEXADECIMAL = T.let(T.unsafe(nil), Integer) + +# 0o or 0 prefix +# +# source://prism//lib/prism/node.rb#18515 +Prism::IntegerBaseFlags::OCTAL = T.let(T.unsafe(nil), Integer) + +# Represents an integer number literal. +# +# 1 +# ^ +# +# source://prism//lib/prism/node.rb#10386 +class Prism::IntegerNode < ::Prism::Node + # Initialize a new IntegerNode node. # - # @return [KeywordHashNode] a new instance of KeywordHashNode + # @return [IntegerNode] a new instance of IntegerNode # - # source://prism//lib/prism/node.rb#12287 + # source://prism//lib/prism/node.rb#10388 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], - location: Prism::Location + value: Integer ).void end - def initialize(source, flags, elements, location); end + def initialize(source, node_id, location, flags, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12379 + # source://prism//lib/prism/node.rb#10469 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12296 + # source://prism//lib/prism/node.rb#10397 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # def binary?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10430 + sig { returns(T::Boolean) } + def binary?; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12301 + # source://prism//lib/prism/node.rb#10402 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12311 + # source://prism//lib/prism/node.rb#10412 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12306 + # source://prism//lib/prism/node.rb#10407 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode], ?location: Location) -> KeywordHashNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode # - # source://prism//lib/prism/node.rb#12316 + # source://prism//lib/prism/node.rb#10417 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], - location: Prism::Location - ).returns(Prism::KeywordHashNode) + value: Integer + ).returns(Prism::IntegerNode) end - def copy(flags: T.unsafe(nil), elements: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end + + # def decimal?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10435 + sig { returns(T::Boolean) } + def decimal?; end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12301 + # source://prism//lib/prism/node.rb#10402 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, elements: Array[AssocNode | AssocSplatNode], location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Integer } # - # source://prism//lib/prism/node.rb#12324 + # source://prism//lib/prism/node.rb#10425 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader elements: Array[AssocNode | AssocSplatNode] - # - # source://prism//lib/prism/node.rb#12333 - sig { returns(T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)]) } - def elements; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#12341 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def symbol_keys?: () -> bool + # def hexadecimal?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#12336 + # source://prism//lib/prism/node.rb#10445 sig { returns(T::Boolean) } - def symbol_keys?; end + def hexadecimal?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # def inspect -> String # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#10453 + sig { override.returns(String) } + def inspect; end + + # def octal?: () -> bool # - # def type: () -> Symbol + # @return [Boolean] # - # source://prism//lib/prism/node.rb#12363 + # source://prism//lib/prism/node.rb#10440 + sig { returns(T::Boolean) } + def octal?; end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#10458 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer + # The value of the integer literal as a number. # - # source://prism//lib/prism/node.rb#12329 + # source://prism//lib/prism/node.rb#10450 sig { returns(Integer) } - def flags; end + def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12373 + # source://prism//lib/prism/node.rb#10463 def type; end end end -# Flags for keyword hash nodes. +# Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object. # -# source://prism//lib/prism/node.rb#20397 -module Prism::KeywordHashNodeFlags; end - -# a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments +# if /foo #{bar} baz/ then end +# ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#20399 -Prism::KeywordHashNodeFlags::SYMBOL_KEYS = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/node.rb#10480 +class Prism::InterpolatedMatchLastLineNode < ::Prism::Node + include ::Prism::RegularExpressionOptions -# Represents a keyword rest parameter to a method, block, or lambda definition. -# -# def a(**b) -# ^^^ -# end -# -# source://prism//lib/prism/node.rb#12392 -class Prism::KeywordRestParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol? name, Location? name_loc, Location operator_loc, Location location) -> void + # Initialize a new InterpolatedMatchLastLineNode node. # - # @return [KeywordRestParameterNode] a new instance of KeywordRestParameterNode + # @return [InterpolatedMatchLastLineNode] a new instance of InterpolatedMatchLastLineNode # - # source://prism//lib/prism/node.rb#12394 + # source://prism//lib/prism/node.rb#10482 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - name: T.nilable(Symbol), - name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location ).void end - def initialize(source, flags, name, name_loc, operator_loc, location); end + def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12519 + # source://prism//lib/prism/node.rb#10636 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12405 + # source://prism//lib/prism/node.rb#10493 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # def ascii_8bit?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10551 + sig { returns(T::Boolean) } + def ascii_8bit?; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12410 + # source://prism//lib/prism/node.rb#10498 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#10615 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#10597 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12420 + # source://prism//lib/prism/node.rb#10508 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12415 + # source://prism//lib/prism/node.rb#10503 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location, ?location: Location) -> KeywordRestParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode # - # source://prism//lib/prism/node.rb#12425 + # source://prism//lib/prism/node.rb#10513 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - name: T.nilable(Symbol), - name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::KeywordRestParameterNode) + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedMatchLastLineNode) end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12410 + # source://prism//lib/prism/node.rb#10498 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol?, name_loc: Location?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location } # - # source://prism//lib/prism/node.rb#12433 + # source://prism//lib/prism/node.rb#10521 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # def euc_jp?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10546 + sig { returns(T::Boolean) } + def euc_jp?; end + + # def extended?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10531 + sig { returns(T::Boolean) } + def extended?; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def forced_binary_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12475 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10571 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end - # attr_reader name: Symbol? + # def forced_us_ascii_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12442 - sig { returns(T.nilable(Symbol)) } - def name; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10576 + sig { returns(T::Boolean) } + def forced_us_ascii_encoding?; end - # attr_reader name_loc: Location? + # def forced_utf8_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12445 - sig { returns(T.nilable(Prism::Location)) } - def name_loc; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10566 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # def operator: () -> String + # def ignore_case?: () -> bool # - # source://prism//lib/prism/node.rb#12470 - sig { returns(String) } - def operator; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10526 + sig { returns(T::Boolean) } + def ignore_case?; end - # attr_reader operator_loc: Location + # def inspect -> String # - # source://prism//lib/prism/node.rb#12458 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/node.rb#10620 + sig { override.returns(String) } + def inspect; end - # def repeated_parameter?: () -> bool + # def multi_line?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#12465 + # source://prism//lib/prism/node.rb#10536 sig { returns(T::Boolean) } - def repeated_parameter?; end + def multi_line?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # source://prism//lib/prism/parse_result/newlines.rb#121 + def newline_flag!(lines); end + + # def once?: () -> bool # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10541 + sig { returns(T::Boolean) } + def once?; end + + # def opening: () -> String # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#10610 + sig { returns(String) } + def opening; end + + # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#12503 + # source://prism//lib/prism/node.rb#10581 + sig { returns(Prism::Location) } + def opening_loc; end + + sig { returns(Integer) } + def options; end + + # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] + # + # source://prism//lib/prism/node.rb#10594 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } + def parts; end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#10605 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#10589 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#10625 sig { override.returns(Symbol) } def type; end - protected + # def utf_8?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10561 + sig { returns(T::Boolean) } + def utf_8?; end - # protected attr_reader flags: Integer + # def windows_31j?: () -> bool # - # source://prism//lib/prism/node.rb#12438 - sig { returns(Integer) } - def flags; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10556 + sig { returns(T::Boolean) } + def windows_31j?; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12513 + # source://prism//lib/prism/node.rb#10630 def type; end end end -# Represents using a lambda literal (not the lambda method call). +# Represents a regular expression literal that contains interpolation. # -# ->(value) { value * 2 } -# ^^^^^^^^^^^^^^^^^^^^^^^ +# /foo #{bar} baz/ +# ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#12532 -class Prism::LambdaNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, Location operator_loc, Location opening_loc, Location closing_loc, Prism::node? parameters, Prism::node? body, Location location) -> void +# source://prism//lib/prism/node.rb#10650 +class Prism::InterpolatedRegularExpressionNode < ::Prism::Node + include ::Prism::RegularExpressionOptions + + # Initialize a new InterpolatedRegularExpressionNode node. # - # @return [LambdaNode] a new instance of LambdaNode + # @return [InterpolatedRegularExpressionNode] a new instance of InterpolatedRegularExpressionNode # - # source://prism//lib/prism/node.rb#12534 + # source://prism//lib/prism/node.rb#10652 sig do params( source: Prism::Source, - locals: T::Array[Symbol], - operator_loc: Prism::Location, + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, - closing_loc: Prism::Location, - parameters: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), - location: Prism::Location + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location ).void end - def initialize(source, locals, operator_loc, opening_loc, closing_loc, parameters, body, location); end + def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12679 + # source://prism//lib/prism/node.rb#10806 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12547 + # source://prism//lib/prism/node.rb#10663 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? + # def ascii_8bit?: () -> bool # - # source://prism//lib/prism/node.rb#12610 - sig { returns(T.nilable(Prism::Node)) } - def body; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10721 + sig { returns(T::Boolean) } + def ascii_8bit?; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12552 + # source://prism//lib/prism/node.rb#10668 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#12623 + # source://prism//lib/prism/node.rb#10785 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#12600 + # source://prism//lib/prism/node.rb#10767 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12565 + # source://prism//lib/prism/node.rb#10678 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12557 + # source://prism//lib/prism/node.rb#10673 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: Prism::node?, ?body: Prism::node?, ?location: Location) -> LambdaNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode # - # source://prism//lib/prism/node.rb#12570 + # source://prism//lib/prism/node.rb#10683 sig do params( - locals: T::Array[Symbol], - operator_loc: Prism::Location, + node_id: Integer, + location: Prism::Location, + flags: Integer, opening_loc: Prism::Location, - closing_loc: Prism::Location, - parameters: T.nilable(Prism::Node), - body: T.nilable(Prism::Node), - location: Prism::Location - ).returns(Prism::LambdaNode) + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedRegularExpressionNode) end - def copy(locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12552 + # source://prism//lib/prism/node.rb#10668 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: Prism::node?, body: Prism::node?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location } # - # source://prism//lib/prism/node.rb#12578 + # source://prism//lib/prism/node.rb#10691 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # def euc_jp?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10716 + sig { returns(T::Boolean) } + def euc_jp?; end + + # def extended?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10701 + sig { returns(T::Boolean) } + def extended?; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def forced_binary_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12628 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # attr_reader locals: Array[Symbol] + # @return [Boolean] # - # source://prism//lib/prism/node.rb#12583 - sig { returns(T::Array[Symbol]) } - def locals; end + # source://prism//lib/prism/node.rb#10741 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end - # def opening: () -> String + # def forced_us_ascii_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12618 - sig { returns(String) } - def opening; end - - # attr_reader opening_loc: Location + # @return [Boolean] # - # source://prism//lib/prism/node.rb#12593 - sig { returns(Prism::Location) } - def opening_loc; end + # source://prism//lib/prism/node.rb#10746 + sig { returns(T::Boolean) } + def forced_us_ascii_encoding?; end - # def operator: () -> String + # def forced_utf8_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#12613 - sig { returns(String) } - def operator; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10736 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # attr_reader operator_loc: Location + # def ignore_case?: () -> bool # - # source://prism//lib/prism/node.rb#12586 - sig { returns(Prism::Location) } - def operator_loc; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10696 + sig { returns(T::Boolean) } + def ignore_case?; end - # attr_reader parameters: Prism::node? + # def inspect -> String # - # source://prism//lib/prism/node.rb#12607 - sig { returns(T.nilable(Prism::Node)) } - def parameters; end + # source://prism//lib/prism/node.rb#10790 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # def multi_line?: () -> bool # - # def type: () -> Symbol + # @return [Boolean] # - # source://prism//lib/prism/node.rb#12663 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#10706 + sig { returns(T::Boolean) } + def multi_line?; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12673 - def type; end - end -end + # source://prism//lib/prism/parse_result/newlines.rb#128 + def newline_flag!(lines); end -# This class is responsible for lexing the source using prism and then -# converting those tokens to be compatible with Ripper. In the vast majority -# of cases, this is a one-to-one mapping of the token type. Everything else -# generally lines up. However, there are a few cases that require special -# handling. -# -# source://prism//lib/prism/lex_compat.rb#12 -class Prism::LexCompat - # @return [LexCompat] a new instance of LexCompat + # def once?: () -> bool # - # source://prism//lib/prism/lex_compat.rb#619 - def initialize(source, **options); end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10711 + sig { returns(T::Boolean) } + def once?; end - # Returns the value of attribute options. + # def opening: () -> String # - # source://prism//lib/prism/lex_compat.rb#617 + # source://prism//lib/prism/node.rb#10780 + sig { returns(String) } + def opening; end + + # attr_reader opening_loc: Location + # + # source://prism//lib/prism/node.rb#10751 + sig { returns(Prism::Location) } + def opening_loc; end + + sig { returns(Integer) } def options; end - # source://prism//lib/prism/lex_compat.rb#624 - def result; end + # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] + # + # source://prism//lib/prism/node.rb#10764 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } + def parts; end - # Returns the value of attribute source. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/lex_compat.rb#617 - def source; end -end + # source://prism//lib/prism/node.rb#10775 + def save_closing_loc(repository); end -# Ripper doesn't include the rest of the token in the event, so we need to -# trim it down to just the content on the first line when comparing. -# -# source://prism//lib/prism/lex_compat.rb#230 -class Prism::LexCompat::EndContentToken < ::Prism::LexCompat::Token - # source://prism//lib/prism/lex_compat.rb#231 - def ==(other); end -end + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#10759 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#10795 + sig { override.returns(Symbol) } + def type; end + + # def utf_8?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10731 + sig { returns(T::Boolean) } + def utf_8?; end + + # def windows_31j?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10726 + sig { returns(T::Boolean) } + def windows_31j?; end -# A heredoc in this case is a list of tokens that belong to the body of the -# heredoc that should be appended onto the list of tokens when the heredoc -# closes. -# -# source://prism//lib/prism/lex_compat.rb#291 -module Prism::LexCompat::Heredoc class << self - # Here we will split between the two types of heredocs and return the - # object that will store their tokens. + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/lex_compat.rb#603 - def build(opening); end + # source://prism//lib/prism/node.rb#10800 + def type; end end end -# Dash heredocs are a little more complicated. They are a list of tokens -# that need to be split on "\\\n" to mimic Ripper's behavior. We also need -# to keep track of the state that the heredoc was opened in. +# Represents a string literal that contains interpolation. # -# source://prism//lib/prism/lex_compat.rb#315 -class Prism::LexCompat::Heredoc::DashHeredoc - # @return [DashHeredoc] a new instance of DashHeredoc - # - # source://prism//lib/prism/lex_compat.rb#318 - def initialize(split); end +# "foo #{bar} baz" +# ^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#10820 +class Prism::InterpolatedStringNode < ::Prism::Node + include ::Prism::HeredocQuery - # source://prism//lib/prism/lex_compat.rb#323 - def <<(token); end + # Initialize a new InterpolatedStringNode node. + # + # @return [InterpolatedStringNode] a new instance of InterpolatedStringNode + # + # source://prism//lib/prism/node.rb#10822 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode, Prism::XStringNode)], + closing_loc: T.nilable(Prism::Location) + ).void + end + def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end - # source://prism//lib/prism/lex_compat.rb#316 - def split; end + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. + # + # source://prism//lib/prism/node.rb#10943 + def ===(other); end - # source://prism//lib/prism/lex_compat.rb#327 - def to_a; end + # def accept: (Visitor visitor) -> void + # + # source://prism//lib/prism/node.rb#10833 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # source://prism//lib/prism/lex_compat.rb#316 - def tokens; end -end + # def child_nodes: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#10838 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end -# Heredocs that are dedenting heredocs are a little more complicated. -# Ripper outputs on_ignored_sp tokens for the whitespace that is being -# removed from the output. prism only modifies the node itself and keeps -# the token the same. This simplifies prism, but makes comparing against -# Ripper much harder because there is a length mismatch. -# -# Fortunately, we already have to pull out the heredoc tokens in order to -# insert them into the stream in the correct order. As such, we can do -# some extra manipulation on the tokens to make them match Ripper's -# output by mirroring the dedent logic that Ripper uses. -# -# source://prism//lib/prism/lex_compat.rb#374 -class Prism::LexCompat::Heredoc::DedentingHeredoc - # @return [DedentingHeredoc] a new instance of DedentingHeredoc + # def closing: () -> String? # - # source://prism//lib/prism/lex_compat.rb#379 - def initialize; end + # source://prism//lib/prism/node.rb#10922 + sig { returns(T.nilable(String)) } + def closing; end - # As tokens are coming in, we track the minimum amount of common leading - # whitespace on plain string content tokens. This allows us to later - # remove that amount of whitespace from the beginning of each line. + # attr_reader closing_loc: Location? # - # source://prism//lib/prism/lex_compat.rb#390 - def <<(token); end + # source://prism//lib/prism/node.rb#10898 + sig { returns(T.nilable(Prism::Location)) } + def closing_loc; end - # Returns the value of attribute dedent. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/lex_compat.rb#377 - def dedent; end + # source://prism//lib/prism/node.rb#10848 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Returns the value of attribute dedent_next. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/lex_compat.rb#377 - def dedent_next; end + # source://prism//lib/prism/node.rb#10843 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Returns the value of attribute embexpr_balance. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode], ?closing_loc: Location?) -> InterpolatedStringNode # - # source://prism//lib/prism/lex_compat.rb#377 - def embexpr_balance; end + # source://prism//lib/prism/node.rb#10853 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode, Prism::XStringNode)], + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::InterpolatedStringNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # source://prism//lib/prism/lex_compat.rb#427 - def to_a; end + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#10838 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Returns the value of attribute tokens. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode], closing_loc: Location? } # - # source://prism//lib/prism/lex_compat.rb#377 - def tokens; end -end + # source://prism//lib/prism/node.rb#10861 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end -# source://prism//lib/prism/lex_compat.rb#375 -Prism::LexCompat::Heredoc::DedentingHeredoc::TAB_WIDTH = T.let(T.unsafe(nil), Integer) + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end -# Heredocs that are no dash or tilde heredocs are just a list of tokens. -# We need to keep them around so that we can insert them in the correct -# order back into the token stream and set the state of the last token to -# the state that the heredoc was opened in. -# -# source://prism//lib/prism/lex_compat.rb#296 -class Prism::LexCompat::Heredoc::PlainHeredoc - # @return [PlainHeredoc] a new instance of PlainHeredoc + # def frozen?: () -> bool # - # source://prism//lib/prism/lex_compat.rb#299 - def initialize; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10866 + sig { returns(T::Boolean) } + def frozen?; end - # source://prism//lib/prism/lex_compat.rb#303 - def <<(token); end + sig { returns(T::Boolean) } + def heredoc?; end - # source://prism//lib/prism/lex_compat.rb#307 - def to_a; end + # def inspect -> String + # + # source://prism//lib/prism/node.rb#10927 + sig { override.returns(String) } + def inspect; end - # source://prism//lib/prism/lex_compat.rb#297 - def tokens; end -end + # def mutable?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#10871 + sig { returns(T::Boolean) } + def mutable?; end -# Ident tokens for the most part are exactly the same, except sometimes we -# know an ident is a local when ripper doesn't (when they are introduced -# through named captures in regular expressions). In that case we don't -# compare the state. -# -# source://prism//lib/prism/lex_compat.rb#248 -class Prism::LexCompat::IdentToken < ::Prism::LexCompat::Token - # source://prism//lib/prism/lex_compat.rb#249 - def ==(other); end -end + # source://prism//lib/prism/parse_result/newlines.rb#135 + def newline_flag!(lines); end -# Tokens where state should be ignored -# used for :on_comment, :on_heredoc_end, :on_embexpr_end -# -# source://prism//lib/prism/lex_compat.rb#238 -class Prism::LexCompat::IgnoreStateToken < ::Prism::LexCompat::Token - # source://prism//lib/prism/lex_compat.rb#239 - def ==(other); end -end - -# Ignored newlines can occasionally have a LABEL state attached to them, so -# we compare the state differently here. -# -# source://prism//lib/prism/lex_compat.rb#259 -class Prism::LexCompat::IgnoredNewlineToken < ::Prism::LexCompat::Token - # source://prism//lib/prism/lex_compat.rb#260 - def ==(other); end -end - -# If we have an identifier that follows a method name like: -# -# def foo bar -# -# then Ripper will mark bar as END|LABEL if there is a local in a parent -# scope named bar because it hasn't pushed the local table yet. We do this -# more accurately, so we need to allow comparing against both END and -# END|LABEL. -# -# source://prism//lib/prism/lex_compat.rb#279 -class Prism::LexCompat::ParamToken < ::Prism::LexCompat::Token - # source://prism//lib/prism/lex_compat.rb#280 - def ==(other); end -end - -# This is a mapping of prism token types to Ripper token types. This is a -# many-to-one mapping because we split up our token types, whereas Ripper -# tends to group them. -# -# source://prism//lib/prism/lex_compat.rb#33 -Prism::LexCompat::RIPPER = T.let(T.unsafe(nil), Hash) - -# A result class specialized for holding tokens produced by the lexer. -# -# source://prism//lib/prism/lex_compat.rb#14 -class Prism::LexCompat::Result < ::Prism::Result - # Create a new lex compat result object with the given values. - # - # @return [Result] a new instance of Result - # - # source://prism//lib/prism/lex_compat.rb#19 - def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - - # Implement the hash pattern matching interface for Result. + # def opening: () -> String? # - # source://prism//lib/prism/lex_compat.rb#25 - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#10917 + sig { returns(T.nilable(String)) } + def opening; end - # The list of tokens that were produced by the lexer. + # attr_reader opening_loc: Location? # - # source://prism//lib/prism/lex_compat.rb#16 - def value; end -end + # source://prism//lib/prism/node.rb#10876 + sig { returns(T.nilable(Prism::Location)) } + def opening_loc; end -# When we produce tokens, we produce the same arrays that Ripper does. -# However, we add a couple of convenience methods onto them to make them a -# little easier to work with. We delegate all other methods to the array. -# -# source://prism//lib/prism/lex_compat.rb#204 -class Prism::LexCompat::Token < ::SimpleDelegator - # The type of the token. + # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode] # - # source://prism//lib/prism/lex_compat.rb#213 - def event; end + # source://prism//lib/prism/node.rb#10895 + sig do + returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode, Prism::InterpolatedStringNode, Prism::XStringNode)]) + end + def parts; end - # The location of the token in the source. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/lex_compat.rb#208 - def location; end + # source://prism//lib/prism/node.rb#10912 + def save_closing_loc(repository); end - # The state of the lexer when this token was produced. + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/lex_compat.rb#223 - def state; end + # source://prism//lib/prism/node.rb#10890 + def save_opening_loc(repository); end - # The slice of the source that this token represents. + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/lex_compat.rb#218 - def value; end -end + # source://prism//lib/prism/node.rb#10932 + sig { override.returns(Symbol) } + def type; end -# This is a result specific to the `lex` and `lex_file` methods. -# -# source://prism//lib/prism/parse_result.rb#515 -class Prism::LexResult < ::Prism::Result - # Create a new lex result object with the given values. - # - # @return [LexResult] a new instance of LexResult - # - # source://prism//lib/prism/parse_result.rb#520 - sig do - params( - value: T::Array[T.untyped], - comments: T::Array[Prism::Comment], - magic_comments: T::Array[Prism::MagicComment], - data_loc: T.nilable(Prism::Location), - errors: T::Array[Prism::ParseError], - warnings: T::Array[Prism::ParseWarning], - source: Prism::Source - ).void + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#10937 + def type; end end - def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - - # Implement the hash pattern matching interface for LexResult. - # - # source://prism//lib/prism/parse_result.rb#526 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end - - # The list of tokens that were parsed from the source code. - # - # source://prism//lib/prism/parse_result.rb#517 - sig { returns(T::Array[T.untyped]) } - def value; end end -# This is a class that wraps the Ripper lexer to produce almost exactly the -# same tokens. +# Flags for interpolated string nodes that indicated mutability if they are also marked as literals. # -# source://prism//lib/prism/lex_compat.rb#872 -class Prism::LexRipper - # @return [LexRipper] a new instance of LexRipper - # - # source://prism//lib/prism/lex_compat.rb#875 - def initialize(source); end - - # source://prism//lib/prism/lex_compat.rb#879 - def result; end - - # source://prism//lib/prism/lex_compat.rb#873 - def source; end +# source://prism//lib/prism/node.rb#18522 +module Prism::InterpolatedStringNodeFlags; end - private +# source://prism//lib/prism/node.rb#18524 +Prism::InterpolatedStringNodeFlags::FROZEN = T.let(T.unsafe(nil), Integer) - # source://prism//lib/prism/lex_compat.rb#913 - def lex(source); end -end +# source://prism//lib/prism/node.rb#18527 +Prism::InterpolatedStringNodeFlags::MUTABLE = T.let(T.unsafe(nil), Integer) -# Represents the use of the `&&=` operator for assignment to a local variable. +# Represents a symbol literal that contains interpolation. # -# target &&= value -# ^^^^^^^^^^^^^^^^ +# :"foo #{bar} baz" +# ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#12695 -class Prism::LocalVariableAndWriteNode < ::Prism::Node - # def initialize: (Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth, Location location) -> void +# source://prism//lib/prism/node.rb#10957 +class Prism::InterpolatedSymbolNode < ::Prism::Node + # Initialize a new InterpolatedSymbolNode node. # - # @return [LocalVariableAndWriteNode] a new instance of LocalVariableAndWriteNode + # @return [InterpolatedSymbolNode] a new instance of InterpolatedSymbolNode # - # source://prism//lib/prism/node.rb#12697 + # source://prism//lib/prism/node.rb#10959 sig do params( source: Prism::Source, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - depth: Integer, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: T.nilable(Prism::Location) ).void end - def initialize(source, name_loc, operator_loc, value, name, depth, location); end + def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12811 + # source://prism//lib/prism/node.rb#11070 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12709 + # source://prism//lib/prism/node.rb#10970 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12714 + # source://prism//lib/prism/node.rb#10975 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String? + # + # source://prism//lib/prism/node.rb#11049 + sig { returns(T.nilable(String)) } + def closing; end + + # attr_reader closing_loc: Location? + # + # source://prism//lib/prism/node.rb#11025 + sig { returns(T.nilable(Prism::Location)) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12724 + # source://prism//lib/prism/node.rb#10985 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12719 + # source://prism//lib/prism/node.rb#10980 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableAndWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode # - # source://prism//lib/prism/node.rb#12729 + # source://prism//lib/prism/node.rb#10990 sig do params( - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - depth: Integer, - location: Prism::Location - ).returns(Prism::LocalVariableAndWriteNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::InterpolatedSymbolNode) end - def copy(name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12714 + # source://prism//lib/prism/node.rb#10975 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location? } # - # source://prism//lib/prism/node.rb#12737 + # source://prism//lib/prism/node.rb#10998 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader depth: Integer - # - # source://prism//lib/prism/node.rb#12762 - sig { returns(Integer) } - def depth; end - - # source://prism//lib/prism/desugar_compiler.rb#199 - def desugar; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#12770 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11054 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol - # - # source://prism//lib/prism/node.rb#12759 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/parse_result/newlines.rb#142 + def newline_flag!(lines); end - # attr_reader name_loc: Location + # def opening: () -> String? # - # source://prism//lib/prism/node.rb#12742 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/node.rb#11044 + sig { returns(T.nilable(String)) } + def opening; end - # def operator: () -> String + # attr_reader opening_loc: Location? # - # source://prism//lib/prism/node.rb#12765 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/node.rb#11003 + sig { returns(T.nilable(Prism::Location)) } + def opening_loc; end - # attr_reader operator_loc: Location + # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] # - # source://prism//lib/prism/node.rb#12749 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/node.rb#11022 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } + def parts; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#11039 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#11017 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#12795 + # source://prism//lib/prism/node.rb#11059 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node - # - # source://prism//lib/prism/node.rb#12756 - sig { returns(Prism::Node) } - def value; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#12805 + # source://prism//lib/prism/node.rb#11064 def type; end end end -# Represents assigning to a local variable using an operator that isn't `=`. +# Represents an xstring literal that contains interpolation. # -# target += value -# ^^^^^^^^^^^^^^^ +# `foo #{bar} baz` +# ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#12825 -class Prism::LocalVariableOperatorWriteNode < ::Prism::Node - # def initialize: (Location name_loc, Location operator_loc, Prism::node value, Symbol name, Symbol operator, Integer depth, Location location) -> void +# source://prism//lib/prism/node.rb#11083 +class Prism::InterpolatedXStringNode < ::Prism::Node + include ::Prism::HeredocQuery + + # Initialize a new InterpolatedXStringNode node. # - # @return [LocalVariableOperatorWriteNode] a new instance of LocalVariableOperatorWriteNode + # @return [InterpolatedXStringNode] a new instance of InterpolatedXStringNode # - # source://prism//lib/prism/node.rb#12827 + # source://prism//lib/prism/node.rb#11085 sig do params( source: Prism::Source, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - operator: Symbol, - depth: Integer, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location ).void end - def initialize(source, name_loc, operator_loc, value, name, operator, depth, location); end + def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#12941 + # source://prism//lib/prism/node.rb#11184 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12840 + # source://prism//lib/prism/node.rb#11096 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12845 + # source://prism//lib/prism/node.rb#11101 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#11163 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#11145 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12855 + # source://prism//lib/prism/node.rb#11111 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12850 + # source://prism//lib/prism/node.rb#11106 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?operator: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableOperatorWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode # - # source://prism//lib/prism/node.rb#12860 + # source://prism//lib/prism/node.rb#11116 sig do params( - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - operator: Symbol, - depth: Integer, - location: Prism::Location - ).returns(Prism::LocalVariableOperatorWriteNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedXStringNode) end - def copy(name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), operator: T.unsafe(nil), depth: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12845 + # source://prism//lib/prism/node.rb#11101 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, operator: Symbol, depth: Integer, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location } # - # source://prism//lib/prism/node.rb#12868 + # source://prism//lib/prism/node.rb#11124 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader depth: Integer - # - # source://prism//lib/prism/node.rb#12896 - sig { returns(Integer) } - def depth; end - - # source://prism//lib/prism/desugar_compiler.rb#211 - def desugar; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + sig { returns(T::Boolean) } + def heredoc?; end + + # def inspect -> String # - # source://prism//lib/prism/node.rb#12899 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11168 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # source://prism//lib/prism/parse_result/newlines.rb#149 + def newline_flag!(lines); end + + # def opening: () -> String # - # source://prism//lib/prism/node.rb#12890 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/node.rb#11158 + sig { returns(String) } + def opening; end - # attr_reader name_loc: Location + # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#12873 + # source://prism//lib/prism/node.rb#11129 sig { returns(Prism::Location) } - def name_loc; end + def opening_loc; end - # attr_reader operator: Symbol + # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] # - # source://prism//lib/prism/node.rb#12893 - sig { returns(Symbol) } - def operator; end + # source://prism//lib/prism/node.rb#11142 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } + def parts; end - # attr_reader operator_loc: Location + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#12880 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/node.rb#11153 + def save_closing_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#11137 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#12925 + # source://prism//lib/prism/node.rb#11173 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node - # - # source://prism//lib/prism/node.rb#12887 - sig { returns(Prism::Node) } - def value; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#12935 + # source://prism//lib/prism/node.rb#11178 def type; end end end -# Represents the use of the `||=` operator for assignment to a local variable. +# Represents reading from the implicit `it` local variable. # -# target ||= value -# ^^^^^^^^^^^^^^^^ +# -> { it } +# ^^ # -# source://prism//lib/prism/node.rb#12956 -class Prism::LocalVariableOrWriteNode < ::Prism::Node - # def initialize: (Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth, Location location) -> void +# source://prism//lib/prism/node.rb#11197 +class Prism::ItLocalVariableReadNode < ::Prism::Node + # Initialize a new ItLocalVariableReadNode node. # - # @return [LocalVariableOrWriteNode] a new instance of LocalVariableOrWriteNode + # @return [ItLocalVariableReadNode] a new instance of ItLocalVariableReadNode # - # source://prism//lib/prism/node.rb#12958 - sig do - params( - source: Prism::Source, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - depth: Integer, - location: Prism::Location - ).void - end - def initialize(source, name_loc, operator_loc, value, name, depth, location); end + # source://prism//lib/prism/node.rb#11199 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13072 + # source://prism//lib/prism/node.rb#11256 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#12970 + # source://prism//lib/prism/node.rb#11207 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12975 + # source://prism//lib/prism/node.rb#11212 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#12985 + # source://prism//lib/prism/node.rb#11222 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#12980 + # source://prism//lib/prism/node.rb#11217 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableOrWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItLocalVariableReadNode # - # source://prism//lib/prism/node.rb#12990 - sig do - params( - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - name: Symbol, - depth: Integer, - location: Prism::Location - ).returns(Prism::LocalVariableOrWriteNode) - end - def copy(name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11227 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ItLocalVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#12975 + # source://prism//lib/prism/node.rb#11212 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#12998 + # source://prism//lib/prism/node.rb#11235 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader depth: Integer - # - # source://prism//lib/prism/node.rb#13023 - sig { returns(Integer) } - def depth; end - - # source://prism//lib/prism/desugar_compiler.rb#205 - def desugar; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#13031 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # attr_reader name: Symbol - # - # source://prism//lib/prism/node.rb#13020 - sig { returns(Symbol) } - def name; end - - # attr_reader name_loc: Location - # - # source://prism//lib/prism/node.rb#13003 - sig { returns(Prism::Location) } - def name_loc; end - - # def operator: () -> String - # - # source://prism//lib/prism/node.rb#13026 - sig { returns(String) } - def operator; end - - # attr_reader operator_loc: Location + # def inspect -> String # - # source://prism//lib/prism/node.rb#13010 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/node.rb#11240 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#13056 + # source://prism//lib/prism/node.rb#11245 sig { override.returns(Symbol) } def type; end - # attr_reader value: Prism::node - # - # source://prism//lib/prism/node.rb#13017 - sig { returns(Prism::Node) } - def value; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#13066 + # source://prism//lib/prism/node.rb#11250 def type; end end end -# Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call. +# Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda. # -# foo -# ^^^ +# -> { it + it } +# ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#13086 -class Prism::LocalVariableReadNode < ::Prism::Node - # def initialize: (Symbol name, Integer depth, Location location) -> void +# source://prism//lib/prism/node.rb#11265 +class Prism::ItParametersNode < ::Prism::Node + # Initialize a new ItParametersNode node. # - # @return [LocalVariableReadNode] a new instance of LocalVariableReadNode + # @return [ItParametersNode] a new instance of ItParametersNode # - # source://prism//lib/prism/node.rb#13088 - sig { params(source: Prism::Source, name: Symbol, depth: Integer, location: Prism::Location).void } - def initialize(source, name, depth, location); end + # source://prism//lib/prism/node.rb#11267 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13191 + # source://prism//lib/prism/node.rb#11324 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13097 + # source://prism//lib/prism/node.rb#11275 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13102 + # source://prism//lib/prism/node.rb#11280 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13112 + # source://prism//lib/prism/node.rb#11290 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13107 + # source://prism//lib/prism/node.rb#11285 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableReadNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItParametersNode # - # source://prism//lib/prism/node.rb#13117 - sig { params(name: Symbol, depth: Integer, location: Prism::Location).returns(Prism::LocalVariableReadNode) } - def copy(name: T.unsafe(nil), depth: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11295 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ItParametersNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13102 + # source://prism//lib/prism/node.rb#11280 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, depth: Integer, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#13125 + # source://prism//lib/prism/node.rb#11303 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # The number of visible scopes that should be searched to find the origin of this local variable. - # - # foo = 1; foo # depth 0 - # - # bar = 2; tap { bar } # depth 1 - # - # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). - # - # source://prism//lib/prism/node.rb#13151 - sig { returns(Integer) } - def depth; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#13154 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). - # - # x # name `:x` - # - # _Test # name `:_Test` - # - # Note that this can also be an underscore followed by a number for the default block parameters. + # def inspect -> String # - # _1 # name `:_1` - # - # Finally, for the default `it` block parameter, the name is `0it`. This is to distinguish it from an `it` local variable that is explicitly declared. - # - # it # name `:0it` - # - # source://prism//lib/prism/node.rb#13142 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/node.rb#11308 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13175 + # source://prism//lib/prism/node.rb#11313 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#13185 + # source://prism//lib/prism/node.rb#11318 def type; end end end -# Represents writing to a local variable in a context that doesn't have an explicit value. +# Represents a hash literal without opening and closing braces. # -# foo, bar = baz -# ^^^ ^^^ +# foo(a: b) +# ^^^^ # -# source://prism//lib/prism/node.rb#13202 -class Prism::LocalVariableTargetNode < ::Prism::Node - # def initialize: (Symbol name, Integer depth, Location location) -> void +# source://prism//lib/prism/node.rb#11333 +class Prism::KeywordHashNode < ::Prism::Node + # Initialize a new KeywordHashNode node. # - # @return [LocalVariableTargetNode] a new instance of LocalVariableTargetNode + # @return [KeywordHashNode] a new instance of KeywordHashNode # - # source://prism//lib/prism/node.rb#13204 - sig { params(source: Prism::Source, name: Symbol, depth: Integer, location: Prism::Location).void } - def initialize(source, name, depth, location); end + # source://prism//lib/prism/node.rb#11335 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)] + ).void + end + def initialize(source, node_id, location, flags, elements); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13289 + # source://prism//lib/prism/node.rb#11401 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13213 + # source://prism//lib/prism/node.rb#11344 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13218 + # source://prism//lib/prism/node.rb#11349 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13228 + # source://prism//lib/prism/node.rb#11359 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13223 + # source://prism//lib/prism/node.rb#11354 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableTargetNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode # - # source://prism//lib/prism/node.rb#13233 - sig { params(name: Symbol, depth: Integer, location: Prism::Location).returns(Prism::LocalVariableTargetNode) } - def copy(name: T.unsafe(nil), depth: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11364 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)] + ).returns(Prism::KeywordHashNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13218 + # source://prism//lib/prism/node.rb#11349 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, depth: Integer, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, elements: Array[AssocNode | AssocSplatNode] } # - # source://prism//lib/prism/node.rb#13241 + # source://prism//lib/prism/node.rb#11372 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader depth: Integer + # attr_reader elements: Array[AssocNode | AssocSplatNode] # - # source://prism//lib/prism/node.rb#13249 - sig { returns(Integer) } - def depth; end + # source://prism//lib/prism/node.rb#11382 + sig { returns(T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)]) } + def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#13252 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11385 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # def symbol_keys?: () -> bool # - # source://prism//lib/prism/node.rb#13246 - sig { returns(Symbol) } - def name; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#11377 + sig { returns(T::Boolean) } + def symbol_keys?; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13273 + # source://prism//lib/prism/node.rb#11390 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#13283 + # source://prism//lib/prism/node.rb#11395 def type; end end end -# Represents writing to a local variable. +# Flags for keyword hash nodes. # -# foo = 1 -# ^^^^^^^ +# source://prism//lib/prism/node.rb#18531 +module Prism::KeywordHashNodeFlags; end + +# a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments # -# source://prism//lib/prism/node.rb#13300 -class Prism::LocalVariableWriteNode < ::Prism::Node - # def initialize: (Symbol name, Integer depth, Location name_loc, Prism::node value, Location operator_loc, Location location) -> void +# source://prism//lib/prism/node.rb#18533 +Prism::KeywordHashNodeFlags::SYMBOL_KEYS = T.let(T.unsafe(nil), Integer) + +# Represents a keyword rest parameter to a method, block, or lambda definition. +# +# def a(**b) +# ^^^ +# end +# +# source://prism//lib/prism/node.rb#11414 +class Prism::KeywordRestParameterNode < ::Prism::Node + # Initialize a new KeywordRestParameterNode node. # - # @return [LocalVariableWriteNode] a new instance of LocalVariableWriteNode + # @return [KeywordRestParameterNode] a new instance of KeywordRestParameterNode # - # source://prism//lib/prism/node.rb#13302 + # source://prism//lib/prism/node.rb#11416 sig do params( source: Prism::Source, - name: Symbol, - depth: Integer, - name_loc: Prism::Location, - value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location ).void end - def initialize(source, name, depth, name_loc, value, operator_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13442 + # source://prism//lib/prism/node.rb#11521 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13314 + # source://prism//lib/prism/node.rb#11427 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13319 + # source://prism//lib/prism/node.rb#11432 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13329 + # source://prism//lib/prism/node.rb#11442 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13324 + # source://prism//lib/prism/node.rb#11437 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location, ?location: Location) -> LocalVariableWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode # - # source://prism//lib/prism/node.rb#13334 + # source://prism//lib/prism/node.rb#11447 sig do params( - name: Symbol, - depth: Integer, - name_loc: Prism::Location, - value: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::LocalVariableWriteNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location + ).returns(Prism::KeywordRestParameterNode) end - def copy(name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13319 + # source://prism//lib/prism/node.rb#11432 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, depth: Integer, name_loc: Location, value: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol?, name_loc: Location?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#13342 + # source://prism//lib/prism/node.rb#11455 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # The number of semantic scopes we have to traverse to find the declaration of this variable. - # - # foo = 1 # depth 0 - # - # tap { foo = 1 } # depth 1 - # - # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). - # - # source://prism//lib/prism/node.rb#13360 - sig { returns(Integer) } - def depth; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#13401 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11505 + sig { override.returns(String) } + def inspect; end - # The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). - # - # foo = :bar # name `:foo` - # - # abc = 123 # name `:abc` + # attr_reader name: Symbol? # - # source://prism//lib/prism/node.rb#13351 - sig { returns(Symbol) } + # source://prism//lib/prism/node.rb#11465 + sig { returns(T.nilable(Symbol)) } def name; end - # The location of the variable name. - # - # foo = :bar - # ^^^ + # attr_reader name_loc: Location? # - # source://prism//lib/prism/node.rb#13366 - sig { returns(Prism::Location) } + # source://prism//lib/prism/node.rb#11468 + sig { returns(T.nilable(Prism::Location)) } def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#13396 + # source://prism//lib/prism/node.rb#11500 sig { returns(String) } def operator; end - # The location of the `=` operator. - # - # x = :y - # ^ + # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#13389 + # source://prism//lib/prism/node.rb#11487 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # def repeated_parameter?: () -> bool # - # def type: () -> Symbol + # @return [Boolean] # - # source://prism//lib/prism/node.rb#13426 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#11460 + sig { returns(T::Boolean) } + def repeated_parameter?; end - # The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). - # - # foo = :bar - # ^^^^ - # - # abc = 1234 - # ^^^^ + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write. + # source://prism//lib/prism/node.rb#11482 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # foo = foo + # source://prism//lib/prism/node.rb#11495 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13383 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/node.rb#11510 + sig { override.returns(Symbol) } + def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#13436 + # source://prism//lib/prism/node.rb#11515 def type; end end end -# This represents a location in the source. +# Represents using a lambda literal (not the lambda method call). # -# source://prism//lib/prism/parse_result.rb#104 -class Prism::Location - # Create a new location object with the given source, start byte offset, and - # byte length. +# ->(value) { value * 2 } +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#11534 +class Prism::LambdaNode < ::Prism::Node + # Initialize a new LambdaNode node. # - # @return [Location] a new instance of Location + # @return [LambdaNode] a new instance of LambdaNode # - # source://prism//lib/prism/parse_result.rb#119 - sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void } - def initialize(source, start_offset, length); end + # source://prism//lib/prism/node.rb#11536 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + operator_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location, + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)) + ).void + end + def initialize(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body); end - # Returns true if the given other location is equal to this location. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result.rb#269 - sig { params(other: T.untyped).returns(T::Boolean) } - def ==(other); end + # source://prism//lib/prism/node.rb#11665 + def ===(other); end - # Returns a new location that is the result of chopping off the last byte. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result.rb#165 - sig { returns(Prism::Location) } - def chop; end + # source://prism//lib/prism/node.rb#11550 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Returns all comments that are associated with this location (both leading - # and trailing comments). + # attr_reader body: StatementsNode | BeginNode | nil # - # source://prism//lib/prism/parse_result.rb#155 - sig { returns(T::Array[Prism::Comment]) } - def comments; end + # source://prism//lib/prism/node.rb#11631 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } + def body; end - # Create a new location object with the given options. + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result.rb#160 - sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) } - def copy(source: T.unsafe(nil), start_offset: T.unsafe(nil), length: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11555 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Implement the hash pattern matching interface for Location. + # def closing: () -> String # - # source://prism//lib/prism/parse_result.rb#259 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#11644 + sig { returns(String) } + def closing; end - # The column number in characters where this location ends from the start of - # the line. + # attr_reader closing_loc: Location # - # source://prism//lib/prism/parse_result.rb#248 - sig { returns(Integer) } - def end_character_column; end + # source://prism//lib/prism/node.rb#11615 + sig { returns(Prism::Location) } + def closing_loc; end - # The character offset from the beginning of the source where this location - # ends. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/parse_result.rb#197 - sig { returns(Integer) } - def end_character_offset; end + # source://prism//lib/prism/node.rb#11568 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # The column number in code units of the given encoding where this location - # ends from the start of the line. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/parse_result.rb#254 - sig { params(encoding: Encoding).returns(Integer) } - def end_code_units_column(encoding = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11560 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # The offset from the start of the file in code units of the given encoding. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, ?body: StatementsNode | BeginNode | nil) -> LambdaNode # - # source://prism//lib/prism/parse_result.rb#202 - sig { params(encoding: Encoding).returns(Integer) } - def end_code_units_offset(encoding = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11573 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + operator_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location, + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)) + ).returns(Prism::LambdaNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil)); end - # The column number in bytes where this location ends from the start of the - # line. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result.rb#242 - sig { returns(Integer) } - def end_column; end + # source://prism//lib/prism/node.rb#11555 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # The line number where this location ends. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, body: StatementsNode | BeginNode | nil } # - # source://prism//lib/prism/parse_result.rb#218 - sig { returns(Integer) } - def end_line; end + # source://prism//lib/prism/node.rb#11581 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # The byte offset from the beginning of the source where this location ends. - # - # source://prism//lib/prism/parse_result.rb#191 - sig { returns(Integer) } - def end_offset; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Returns a string representation of this location. + # def inspect -> String # - # source://prism//lib/prism/parse_result.rb#170 - sig { returns(String) } + # source://prism//lib/prism/node.rb#11649 + sig { override.returns(String) } def inspect; end - # Returns a new location that stretches from this location to the given - # other location. Raises an error if this location is not before the other - # location or if they don't share the same source. + # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/parse_result.rb#278 - sig { params(other: Prism::Location).returns(Prism::Location) } - def join(other); end + # source://prism//lib/prism/node.rb#11586 + sig { returns(T::Array[Symbol]) } + def locals; end - # Attach a comment to the leading comments of this location. + # def opening: () -> String # - # source://prism//lib/prism/parse_result.rb#138 - sig { params(comment: Prism::Comment).void } - def leading_comment(comment); end - - # These are the comments that are associated with this location that exist - # before the start of this location. - # - # source://prism//lib/prism/parse_result.rb#133 - sig { returns(T::Array[Prism::Comment]) } - def leading_comments; end - - # The length of this location in bytes. - # - # source://prism//lib/prism/parse_result.rb#115 - sig { returns(Integer) } - def length; end + # source://prism//lib/prism/node.rb#11639 + sig { returns(String) } + def opening; end - # Implement the pretty print interface for Location. + # attr_reader opening_loc: Location # - # source://prism//lib/prism/parse_result.rb#264 - sig { params(q: T.untyped).void } - def pretty_print(q); end + # source://prism//lib/prism/node.rb#11602 + sig { returns(Prism::Location) } + def opening_loc; end - # The source code that this location represents. + # def operator: () -> String # - # source://prism//lib/prism/parse_result.rb#175 + # source://prism//lib/prism/node.rb#11634 sig { returns(String) } - def slice; end - - # The column number in characters where this location ends from the start of - # the line. - # - # source://prism//lib/prism/parse_result.rb#230 - sig { returns(Integer) } - def start_character_column; end + def operator; end - # The character offset from the beginning of the source where this location - # starts. + # attr_reader operator_loc: Location # - # source://prism//lib/prism/parse_result.rb#181 - sig { returns(Integer) } - def start_character_offset; end + # source://prism//lib/prism/node.rb#11589 + sig { returns(Prism::Location) } + def operator_loc; end - # The column number in code units of the given encoding where this location - # starts from the start of the line. + # attr_reader parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil # - # source://prism//lib/prism/parse_result.rb#236 - sig { params(encoding: Encoding).returns(Integer) } - def start_code_units_column(encoding = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11628 + sig { returns(T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode))) } + def parameters; end - # The offset from the start of the file in code units of the given encoding. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/parse_result.rb#186 - sig { params(encoding: Encoding).returns(Integer) } - def start_code_units_offset(encoding = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11623 + def save_closing_loc(repository); end - # The column number in bytes where this location starts from the start of - # the line. + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/parse_result.rb#224 - sig { returns(Integer) } - def start_column; end + # source://prism//lib/prism/node.rb#11610 + def save_opening_loc(repository); end - # The line number where this location starts. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/parse_result.rb#207 - sig { returns(Integer) } - def start_line; end + # source://prism//lib/prism/node.rb#11597 + def save_operator_loc(repository); end - # The content of the line where this location starts before this location. + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/parse_result.rb#212 - sig { returns(String) } - def start_line_slice; end + # source://prism//lib/prism/node.rb#11654 + sig { override.returns(Symbol) } + def type; end - # The byte offset from the beginning of the source where this location - # starts. - # - # source://prism//lib/prism/parse_result.rb#112 - sig { returns(Integer) } - def start_offset; end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#11659 + def type; end + end +end - # Attach a comment to the trailing comments of this location. +# This class is responsible for lexing the source using prism and then +# converting those tokens to be compatible with Ripper. In the vast majority +# of cases, this is a one-to-one mapping of the token type. Everything else +# generally lines up. However, there are a few cases that require special +# handling. +# +# source://prism//lib/prism/lex_compat.rb#12 +class Prism::LexCompat + # @return [LexCompat] a new instance of LexCompat # - # source://prism//lib/prism/parse_result.rb#149 - sig { params(comment: Prism::Comment).void } - def trailing_comment(comment); end + # source://prism//lib/prism/lex_compat.rb#619 + def initialize(source, **options); end - # These are the comments that are associated with this location that exist - # after the end of this location. + # Returns the value of attribute options. # - # source://prism//lib/prism/parse_result.rb#144 - sig { returns(T::Array[Prism::Comment]) } - def trailing_comments; end + # source://prism//lib/prism/lex_compat.rb#617 + def options; end - protected + # source://prism//lib/prism/lex_compat.rb#624 + def result; end - # A Source object that is used to determine more information from the given - # offset and length. + # Returns the value of attribute source. # - # source://prism//lib/prism/parse_result.rb#107 - sig { returns(Prism::Source) } + # source://prism//lib/prism/lex_compat.rb#617 def source; end end -# Flags for while and until loop nodes. +# Ripper doesn't include the rest of the token in the event, so we need to +# trim it down to just the content on the first line when comparing. # -# source://prism//lib/prism/node.rb#20403 -module Prism::LoopFlags; end +# source://prism//lib/prism/lex_compat.rb#230 +class Prism::LexCompat::EndContentToken < ::Prism::LexCompat::Token + # source://prism//lib/prism/lex_compat.rb#231 + def ==(other); end +end -# a loop after a begin statement, so the body is executed first before the condition +# A heredoc in this case is a list of tokens that belong to the body of the +# heredoc that should be appended onto the list of tokens when the heredoc +# closes. # -# source://prism//lib/prism/node.rb#20405 -Prism::LoopFlags::BEGIN_MODIFIER = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/lex_compat.rb#291 +module Prism::LexCompat::Heredoc + class << self + # Here we will split between the two types of heredocs and return the + # object that will store their tokens. + # + # source://prism//lib/prism/lex_compat.rb#603 + def build(opening); end + end +end -# This represents a magic comment that was encountered during parsing. +# Dash heredocs are a little more complicated. They are a list of tokens +# that need to be split on "\\\n" to mimic Ripper's behavior. We also need +# to keep track of the state that the heredoc was opened in. # -# source://prism//lib/prism/parse_result.rb#338 -class Prism::MagicComment - # Create a new magic comment object with the given key and value locations. - # - # @return [MagicComment] a new instance of MagicComment - # - # source://prism//lib/prism/parse_result.rb#346 - sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void } - def initialize(key_loc, value_loc); end - - # Implement the hash pattern matching interface for MagicComment. - # - # source://prism//lib/prism/parse_result.rb#362 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end - - # Returns a string representation of this magic comment. +# source://prism//lib/prism/lex_compat.rb#315 +class Prism::LexCompat::Heredoc::DashHeredoc + # @return [DashHeredoc] a new instance of DashHeredoc # - # source://prism//lib/prism/parse_result.rb#367 - sig { returns(String) } - def inspect; end + # source://prism//lib/prism/lex_compat.rb#318 + def initialize(split); end - # Returns the key of the magic comment by slicing it from the source code. - # - # source://prism//lib/prism/parse_result.rb#352 - sig { returns(String) } - def key; end + # source://prism//lib/prism/lex_compat.rb#323 + def <<(token); end - # A Location object representing the location of the key in the source. - # - # source://prism//lib/prism/parse_result.rb#340 - sig { returns(Prism::Location) } - def key_loc; end + # source://prism//lib/prism/lex_compat.rb#316 + def split; end - # Returns the value of the magic comment by slicing it from the source code. - # - # source://prism//lib/prism/parse_result.rb#357 - sig { returns(String) } - def value; end + # source://prism//lib/prism/lex_compat.rb#327 + def to_a; end - # A Location object representing the location of the value in the source. - # - # source://prism//lib/prism/parse_result.rb#343 - sig { returns(Prism::Location) } - def value_loc; end + # source://prism//lib/prism/lex_compat.rb#316 + def tokens; end end -# Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object. +# Heredocs that are dedenting heredocs are a little more complicated. +# Ripper outputs on_ignored_sp tokens for the whitespace that is being +# removed from the output. prism only modifies the node itself and keeps +# the token the same. This simplifies prism, but makes comparing against +# Ripper much harder because there is a length mismatch. # -# if /foo/i then end -# ^^^^^^ +# Fortunately, we already have to pull out the heredoc tokens in order to +# insert them into the stream in the correct order. As such, we can do +# some extra manipulation on the tokens to make them match Ripper's +# output by mirroring the dedent logic that Ripper uses. # -# source://prism//lib/prism/node.rb#13456 -class Prism::MatchLastLineNode < ::Prism::Node - include ::Prism::RegularExpressionOptions - - # def initialize: (Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped, Location location) -> void - # - # @return [MatchLastLineNode] a new instance of MatchLastLineNode +# source://prism//lib/prism/lex_compat.rb#374 +class Prism::LexCompat::Heredoc::DedentingHeredoc + # @return [DedentingHeredoc] a new instance of DedentingHeredoc # - # source://prism//lib/prism/node.rb#13458 - sig do - params( - source: Prism::Source, - flags: Integer, - opening_loc: Prism::Location, - content_loc: Prism::Location, - closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location - ).void - end - def initialize(source, flags, opening_loc, content_loc, closing_loc, unescaped, location); end + # source://prism//lib/prism/lex_compat.rb#379 + def initialize; end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # As tokens are coming in, we track the minimum amount of common leading + # whitespace on plain string content tokens. This allows us to later + # remove that amount of whitespace from the beginning of each line. # - # source://prism//lib/prism/node.rb#13642 - def ===(other); end + # source://prism//lib/prism/lex_compat.rb#390 + def <<(token); end - # def accept: (Visitor visitor) -> void + # Returns the value of attribute dedent. # - # source://prism//lib/prism/node.rb#13470 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/lex_compat.rb#377 + def dedent; end - # def ascii_8bit?: () -> bool - # - # @return [Boolean] + # Returns the value of attribute dedent_next. # - # source://prism//lib/prism/node.rb#13556 - sig { returns(T::Boolean) } - def ascii_8bit?; end + # source://prism//lib/prism/lex_compat.rb#377 + def dedent_next; end - # def child_nodes: () -> Array[nil | Node] + # Returns the value of attribute embexpr_balance. # - # source://prism//lib/prism/node.rb#13475 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/lex_compat.rb#377 + def embexpr_balance; end - # def closing: () -> String - # - # source://prism//lib/prism/node.rb#13596 - sig { returns(String) } - def closing; end + # source://prism//lib/prism/lex_compat.rb#427 + def to_a; end - # attr_reader closing_loc: Location + # Returns the value of attribute tokens. # - # source://prism//lib/prism/node.rb#13521 - sig { returns(Prism::Location) } - def closing_loc; end + # source://prism//lib/prism/lex_compat.rb#377 + def tokens; end +end - # def comment_targets: () -> Array[Node | Location] - # - # source://prism//lib/prism/node.rb#13485 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end +# source://prism//lib/prism/lex_compat.rb#375 +Prism::LexCompat::Heredoc::DedentingHeredoc::TAB_WIDTH = T.let(T.unsafe(nil), Integer) - # def compact_child_nodes: () -> Array[Node] - # - # source://prism//lib/prism/node.rb#13480 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end - - # def content: () -> String +# Heredocs that are no dash or tilde heredocs are just a list of tokens. +# We need to keep them around so that we can insert them in the correct +# order back into the token stream and set the state of the last token to +# the state that the heredoc was opened in. +# +# source://prism//lib/prism/lex_compat.rb#296 +class Prism::LexCompat::Heredoc::PlainHeredoc + # @return [PlainHeredoc] a new instance of PlainHeredoc # - # source://prism//lib/prism/node.rb#13591 - sig { returns(String) } - def content; end + # source://prism//lib/prism/lex_compat.rb#299 + def initialize; end - # attr_reader content_loc: Location - # - # source://prism//lib/prism/node.rb#13514 - sig { returns(Prism::Location) } - def content_loc; end + # source://prism//lib/prism/lex_compat.rb#303 + def <<(token); end - # def copy: (?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String, ?location: Location) -> MatchLastLineNode - # - # source://prism//lib/prism/node.rb#13490 - sig do - params( - flags: Integer, - opening_loc: Prism::Location, - content_loc: Prism::Location, - closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location - ).returns(Prism::MatchLastLineNode) - end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/lex_compat.rb#307 + def to_a; end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#13475 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/lex_compat.rb#297 + def tokens; end +end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, location: Location } - # - # source://prism//lib/prism/node.rb#13498 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end +# Ident tokens for the most part are exactly the same, except sometimes we +# know an ident is a local when ripper doesn't (when they are introduced +# through named captures in regular expressions). In that case we don't +# compare the state. +# +# source://prism//lib/prism/lex_compat.rb#248 +class Prism::LexCompat::IdentToken < ::Prism::LexCompat::Token + # source://prism//lib/prism/lex_compat.rb#249 + def ==(other); end +end - # def euc_jp?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#13551 - sig { returns(T::Boolean) } - def euc_jp?; end +# Tokens where state should be ignored +# used for :on_comment, :on_heredoc_end, :on_embexpr_end +# +# source://prism//lib/prism/lex_compat.rb#238 +class Prism::LexCompat::IgnoreStateToken < ::Prism::LexCompat::Token + # source://prism//lib/prism/lex_compat.rb#239 + def ==(other); end +end - # def extended?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#13536 - sig { returns(T::Boolean) } - def extended?; end +# Ignored newlines can occasionally have a LABEL state attached to them, so +# we compare the state differently here. +# +# source://prism//lib/prism/lex_compat.rb#259 +class Prism::LexCompat::IgnoredNewlineToken < ::Prism::LexCompat::Token + # source://prism//lib/prism/lex_compat.rb#260 + def ==(other); end +end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end +# If we have an identifier that follows a method name like: +# +# def foo bar +# +# then Ripper will mark bar as END|LABEL if there is a local in a parent +# scope named bar because it hasn't pushed the local table yet. We do this +# more accurately, so we need to allow comparing against both END and +# END|LABEL. +# +# source://prism//lib/prism/lex_compat.rb#279 +class Prism::LexCompat::ParamToken < ::Prism::LexCompat::Token + # source://prism//lib/prism/lex_compat.rb#280 + def ==(other); end +end - # def forced_binary_encoding?: () -> bool +# This is a mapping of prism token types to Ripper token types. This is a +# many-to-one mapping because we split up our token types, whereas Ripper +# tends to group them. +# +# source://prism//lib/prism/lex_compat.rb#33 +Prism::LexCompat::RIPPER = T.let(T.unsafe(nil), Hash) + +# A result class specialized for holding tokens produced by the lexer. +# +# source://prism//lib/prism/lex_compat.rb#14 +class Prism::LexCompat::Result < ::Prism::Result + # Create a new lex compat result object with the given values. # - # @return [Boolean] + # @return [Result] a new instance of Result # - # source://prism//lib/prism/node.rb#13576 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end + # source://prism//lib/prism/lex_compat.rb#19 + def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - # def forced_us_ascii_encoding?: () -> bool - # - # @return [Boolean] + # Implement the hash pattern matching interface for Result. # - # source://prism//lib/prism/node.rb#13581 - sig { returns(T::Boolean) } - def forced_us_ascii_encoding?; end + # source://prism//lib/prism/lex_compat.rb#25 + def deconstruct_keys(keys); end - # def forced_utf8_encoding?: () -> bool + # The list of tokens that were produced by the lexer. # - # @return [Boolean] + # source://prism//lib/prism/lex_compat.rb#16 + def value; end +end + +# When we produce tokens, we produce the same arrays that Ripper does. +# However, we add a couple of convenience methods onto them to make them a +# little easier to work with. We delegate all other methods to the array. +# +# source://prism//lib/prism/lex_compat.rb#204 +class Prism::LexCompat::Token < ::SimpleDelegator + # The type of the token. # - # source://prism//lib/prism/node.rb#13571 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end + # source://prism//lib/prism/lex_compat.rb#213 + def event; end - # def ignore_case?: () -> bool + # The location of the token in the source. # - # @return [Boolean] + # source://prism//lib/prism/lex_compat.rb#208 + def location; end + + # The state of the lexer when this token was produced. # - # source://prism//lib/prism/node.rb#13531 - sig { returns(T::Boolean) } - def ignore_case?; end + # source://prism//lib/prism/lex_compat.rb#223 + def state; end - # def inspect(NodeInspector inspector) -> String + # The slice of the source that this token represents. # - # source://prism//lib/prism/node.rb#13601 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/lex_compat.rb#218 + def value; end +end - # def multi_line?: () -> bool +# This is a result specific to the `lex` and `lex_file` methods. +# +# source://prism//lib/prism/parse_result.rb#781 +class Prism::LexResult < ::Prism::Result + # Create a new lex result object with the given values. # - # @return [Boolean] + # @return [LexResult] a new instance of LexResult # - # source://prism//lib/prism/node.rb#13541 - sig { returns(T::Boolean) } - def multi_line?; end + # source://prism//lib/prism/parse_result.rb#786 + sig do + params( + value: T::Array[T.untyped], + comments: T::Array[Prism::Comment], + magic_comments: T::Array[Prism::MagicComment], + data_loc: T.nilable(Prism::Location), + errors: T::Array[Prism::ParseError], + warnings: T::Array[Prism::ParseWarning], + source: Prism::Source + ).void + end + def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - # def once?: () -> bool - # - # @return [Boolean] + # Implement the hash pattern matching interface for LexResult. # - # source://prism//lib/prism/node.rb#13546 - sig { returns(T::Boolean) } - def once?; end + # source://prism//lib/prism/parse_result.rb#792 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # def opening: () -> String + # The list of tokens that were parsed from the source code. # - # source://prism//lib/prism/node.rb#13586 - sig { returns(String) } - def opening; end + # source://prism//lib/prism/parse_result.rb#783 + sig { returns(T::Array[T.untyped]) } + def value; end +end - # attr_reader opening_loc: Location +# This is a class that wraps the Ripper lexer to produce almost exactly the +# same tokens. +# +# source://prism//lib/prism/lex_compat.rb#872 +class Prism::LexRipper + # @return [LexRipper] a new instance of LexRipper # - # source://prism//lib/prism/node.rb#13507 - sig { returns(Prism::Location) } - def opening_loc; end + # source://prism//lib/prism/lex_compat.rb#875 + def initialize(source); end - sig { returns(Integer) } - def options; end + # source://prism//lib/prism/lex_compat.rb#879 + def result; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/lex_compat.rb#873 + def source; end + + private + + # source://prism//lib/prism/lex_compat.rb#913 + def lex(source); end +end + +# Represents the use of the `&&=` operator for assignment to a local variable. +# +# target &&= value +# ^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#11681 +class Prism::LocalVariableAndWriteNode < ::Prism::Node + # Initialize a new LocalVariableAndWriteNode node. # - # def type: () -> Symbol + # @return [LocalVariableAndWriteNode] a new instance of LocalVariableAndWriteNode # - # source://prism//lib/prism/node.rb#13626 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#11683 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).void + end + def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end - # attr_reader unescaped: String + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13528 - sig { returns(String) } - def unescaped; end + # source://prism//lib/prism/node.rb#11785 + def ===(other); end - # def utf_8?: () -> bool + # def accept: (Visitor visitor) -> void # - # @return [Boolean] + # source://prism//lib/prism/node.rb#11696 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end + + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13566 - sig { returns(T::Boolean) } - def utf_8?; end + # source://prism//lib/prism/node.rb#11701 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # def windows_31j?: () -> bool + # def comment_targets: () -> Array[Node | Location] # - # @return [Boolean] + # source://prism//lib/prism/node.rb#11711 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end + + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13561 - sig { returns(T::Boolean) } - def windows_31j?; end + # source://prism//lib/prism/node.rb#11706 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - protected + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode + # + # source://prism//lib/prism/node.rb#11716 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableAndWriteNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end + + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#11701 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end + + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer } + # + # source://prism//lib/prism/node.rb#11724 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # protected attr_reader flags: Integer + # attr_reader depth: Integer # - # source://prism//lib/prism/node.rb#13503 + # source://prism//lib/prism/node.rb#11761 sig { returns(Integer) } - def flags; end + def depth; end + + # source://prism//lib/prism/desugar_compiler.rb#236 + def desugar; end + + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String + # + # source://prism//lib/prism/node.rb#11769 + sig { override.returns(String) } + def inspect; end + + # attr_reader name: Symbol + # + # source://prism//lib/prism/node.rb#11758 + sig { returns(Symbol) } + def name; end + + # attr_reader name_loc: Location + # + # source://prism//lib/prism/node.rb#11729 + sig { returns(Prism::Location) } + def name_loc; end + + # def operator: () -> String + # + # source://prism//lib/prism/node.rb#11764 + sig { returns(String) } + def operator; end + + # attr_reader operator_loc: Location + # + # source://prism//lib/prism/node.rb#11742 + sig { returns(Prism::Location) } + def operator_loc; end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#11737 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#11750 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#11774 + sig { override.returns(Symbol) } + def type; end + + # attr_reader value: Prism::node + # + # source://prism//lib/prism/node.rb#11755 + sig { returns(Prism::Node) } + def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#13636 + # source://prism//lib/prism/node.rb#11779 def type; end end end -# Represents the use of the modifier `in` operator. +# Represents assigning to a local variable using an operator that isn't `=`. # -# foo in bar -# ^^^^^^^^^^ +# target += value +# ^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#13656 -class Prism::MatchPredicateNode < ::Prism::Node - # def initialize: (Prism::node value, Prism::node pattern, Location operator_loc, Location location) -> void +# source://prism//lib/prism/node.rb#11799 +class Prism::LocalVariableOperatorWriteNode < ::Prism::Node + # Initialize a new LocalVariableOperatorWriteNode node. # - # @return [MatchPredicateNode] a new instance of MatchPredicateNode + # @return [LocalVariableOperatorWriteNode] a new instance of LocalVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#13658 + # source://prism//lib/prism/node.rb#11801 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - pattern: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + name: Symbol, + binary_operator: Symbol, + depth: Integer ).void end - def initialize(source, value, pattern, operator_loc, location); end + def initialize(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13759 + # source://prism//lib/prism/node.rb#11902 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13668 + # source://prism//lib/prism/node.rb#11815 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader binary_operator: Symbol + # + # source://prism//lib/prism/node.rb#11880 + sig { returns(Symbol) } + def binary_operator; end + + # attr_reader binary_operator_loc: Location + # + # source://prism//lib/prism/node.rb#11861 + sig { returns(Prism::Location) } + def binary_operator_loc; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13673 + # source://prism//lib/prism/node.rb#11820 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13683 + # source://prism//lib/prism/node.rb#11830 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13678 + # source://prism//lib/prism/node.rb#11825 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location, ?location: Location) -> MatchPredicateNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode # - # source://prism//lib/prism/node.rb#13688 + # source://prism//lib/prism/node.rb#11835 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, value: Prism::Node, - pattern: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::MatchPredicateNode) + name: Symbol, + binary_operator: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOperatorWriteNode) end - def copy(value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), binary_operator: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13673 + # source://prism//lib/prism/node.rb#11820 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Prism::node, pattern: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, binary_operator_loc: Location, value: Prism::node, name: Symbol, binary_operator: Symbol, depth: Integer } # - # source://prism//lib/prism/node.rb#13696 + # source://prism//lib/prism/node.rb#11843 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # attr_reader depth: Integer + # + # source://prism//lib/prism/node.rb#11883 + sig { returns(Integer) } + def depth; end + + # source://prism//lib/prism/desugar_compiler.rb#248 + def desugar; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#13719 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11886 + sig { override.returns(String) } + def inspect; end - # def operator: () -> String + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#13714 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/node.rb#11877 + sig { returns(Symbol) } + def name; end - # attr_reader operator_loc: Location + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#13707 + # source://prism//lib/prism/node.rb#11848 sig { returns(Prism::Location) } - def operator_loc; end + def name_loc; end - # attr_reader pattern: Prism::node + # Returns the binary operator used to modify the receiver. This method is + # deprecated in favor of #binary_operator. # - # source://prism//lib/prism/node.rb#13704 - sig { returns(Prism::Node) } - def pattern; end + # source://prism//lib/prism/node_ext.rb#451 + def operator; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Returns the location of the binary operator used to modify the receiver. + # This method is deprecated in favor of #binary_operator_loc. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node_ext.rb#458 + def operator_loc; end + + # Save the binary_operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#11869 + def save_binary_operator_loc(repository); end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#11856 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13743 + # source://prism//lib/prism/node.rb#11891 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#13701 + # source://prism//lib/prism/node.rb#11874 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#13753 + # source://prism//lib/prism/node.rb#11896 def type; end end end -# Represents the use of the `=>` operator. +# Represents the use of the `||=` operator for assignment to a local variable. # -# foo => bar -# ^^^^^^^^^^ +# target ||= value +# ^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#13771 -class Prism::MatchRequiredNode < ::Prism::Node - # def initialize: (Prism::node value, Prism::node pattern, Location operator_loc, Location location) -> void +# source://prism//lib/prism/node.rb#11917 +class Prism::LocalVariableOrWriteNode < ::Prism::Node + # Initialize a new LocalVariableOrWriteNode node. # - # @return [MatchRequiredNode] a new instance of MatchRequiredNode + # @return [LocalVariableOrWriteNode] a new instance of LocalVariableOrWriteNode # - # source://prism//lib/prism/node.rb#13773 + # source://prism//lib/prism/node.rb#11919 sig do params( source: Prism::Source, - value: Prism::Node, - pattern: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, operator_loc: Prism::Location, - location: Prism::Location + value: Prism::Node, + name: Symbol, + depth: Integer ).void end - def initialize(source, value, pattern, operator_loc, location); end + def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13874 + # source://prism//lib/prism/node.rb#12021 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13783 + # source://prism//lib/prism/node.rb#11932 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13788 + # source://prism//lib/prism/node.rb#11937 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13798 + # source://prism//lib/prism/node.rb#11947 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13793 + # source://prism//lib/prism/node.rb#11942 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location, ?location: Location) -> MatchRequiredNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode # - # source://prism//lib/prism/node.rb#13803 + # source://prism//lib/prism/node.rb#11952 sig do params( - value: Prism::Node, - pattern: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::MatchRequiredNode) + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOrWriteNode) end - def copy(value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13788 + # source://prism//lib/prism/node.rb#11937 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { value: Prism::node, pattern: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer } # - # source://prism//lib/prism/node.rb#13811 + # source://prism//lib/prism/node.rb#11960 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # attr_reader depth: Integer + # + # source://prism//lib/prism/node.rb#11997 + sig { returns(Integer) } + def depth; end + + # source://prism//lib/prism/desugar_compiler.rb#242 + def desugar; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#12005 + sig { override.returns(String) } + def inspect; end + + # attr_reader name: Symbol + # + # source://prism//lib/prism/node.rb#11994 + sig { returns(Symbol) } + def name; end + + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#13834 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#11965 + sig { returns(Prism::Location) } + def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#13829 + # source://prism//lib/prism/node.rb#12000 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#13822 + # source://prism//lib/prism/node.rb#11978 sig { returns(Prism::Location) } def operator_loc; end - # attr_reader pattern: Prism::node + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#13819 - sig { returns(Prism::Node) } - def pattern; end + # source://prism//lib/prism/node.rb#11973 + def save_name_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#11986 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13858 + # source://prism//lib/prism/node.rb#12010 sig { override.returns(Symbol) } def type; end # attr_reader value: Prism::node # - # source://prism//lib/prism/node.rb#13816 + # source://prism//lib/prism/node.rb#11991 sig { returns(Prism::Node) } def value; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#13868 + # source://prism//lib/prism/node.rb#12015 def type; end end end -# Represents writing local variables using a regular expression match with named capture groups. +# Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call. # -# /(?bar)/ =~ baz -# ^^^^^^^^^^^^^^^^^^^^ +# foo +# ^^^ # -# source://prism//lib/prism/node.rb#13886 -class Prism::MatchWriteNode < ::Prism::Node - # def initialize: (CallNode call, Array[LocalVariableTargetNode] targets, Location location) -> void +# source://prism//lib/prism/node.rb#12035 +class Prism::LocalVariableReadNode < ::Prism::Node + # Initialize a new LocalVariableReadNode node. # - # @return [MatchWriteNode] a new instance of MatchWriteNode + # @return [LocalVariableReadNode] a new instance of LocalVariableReadNode # - # source://prism//lib/prism/node.rb#13888 + # source://prism//lib/prism/node.rb#12037 sig do params( source: Prism::Source, - call: Prism::CallNode, - targets: T::Array[Prism::LocalVariableTargetNode], - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer ).void end - def initialize(source, call, targets, location); end + def initialize(source, node_id, location, flags, name, depth); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#13974 + # source://prism//lib/prism/node.rb#12116 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13897 + # source://prism//lib/prism/node.rb#12047 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader call: CallNode - # - # source://prism//lib/prism/node.rb#13930 - sig { returns(Prism::CallNode) } - def call; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13902 + # source://prism//lib/prism/node.rb#12052 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#13912 + # source://prism//lib/prism/node.rb#12062 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#13907 + # source://prism//lib/prism/node.rb#12057 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?call: CallNode, ?targets: Array[LocalVariableTargetNode], ?location: Location) -> MatchWriteNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode # - # source://prism//lib/prism/node.rb#13917 + # source://prism//lib/prism/node.rb#12067 sig do params( - call: Prism::CallNode, - targets: T::Array[Prism::LocalVariableTargetNode], - location: Prism::Location - ).returns(Prism::MatchWriteNode) - end - def copy(call: T.unsafe(nil), targets: T.unsafe(nil), location: T.unsafe(nil)); end + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableReadNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13902 + # source://prism//lib/prism/node.rb#12052 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { call: CallNode, targets: Array[LocalVariableTargetNode], location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer } # - # source://prism//lib/prism/node.rb#13925 + # source://prism//lib/prism/node.rb#12075 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # The number of visible scopes that should be searched to find the origin of this local variable. + # + # foo = 1; foo # depth 0 + # + # bar = 2; tap { bar } # depth 1 + # + # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). + # + # source://prism//lib/prism/node.rb#12097 + sig { returns(Integer) } + def depth; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#13936 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#12100 + sig { override.returns(String) } + def inspect; end - # attr_reader targets: Array[LocalVariableTargetNode] + # The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # - # source://prism//lib/prism/node.rb#13933 - sig { returns(T::Array[Prism::LocalVariableTargetNode]) } - def targets; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # x # name `:x` # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # _Test # name `:_Test` + # + # Note that this can also be an underscore followed by a number for the default block parameters. # - # def type: () -> Symbol + # _1 # name `:_1` + # + # source://prism//lib/prism/node.rb#12088 + sig { returns(Symbol) } + def name; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#13958 + # source://prism//lib/prism/node.rb#12105 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#13968 + # source://prism//lib/prism/node.rb#12110 def type; end end end -# Represents a node that is missing from the source and results in a syntax error. +# Represents writing to a local variable in a context that doesn't have an explicit value. # -# source://prism//lib/prism/node.rb#13983 -class Prism::MissingNode < ::Prism::Node - # def initialize: (Location location) -> void +# foo, bar = baz +# ^^^ ^^^ +# +# source://prism//lib/prism/node.rb#12127 +class Prism::LocalVariableTargetNode < ::Prism::Node + # Initialize a new LocalVariableTargetNode node. # - # @return [MissingNode] a new instance of MissingNode + # @return [LocalVariableTargetNode] a new instance of LocalVariableTargetNode # - # source://prism//lib/prism/node.rb#13985 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#12129 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).void + end + def initialize(source, node_id, location, flags, name, depth); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#14060 + # source://prism//lib/prism/node.rb#12194 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#13992 + # source://prism//lib/prism/node.rb#12139 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13997 + # source://prism//lib/prism/node.rb#12144 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#14007 + # source://prism//lib/prism/node.rb#12154 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#14002 + # source://prism//lib/prism/node.rb#12149 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> MissingNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode # - # source://prism//lib/prism/node.rb#14012 - sig { params(location: Prism::Location).returns(Prism::MissingNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#12159 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableTargetNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#13997 + # source://prism//lib/prism/node.rb#12144 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer } # - # source://prism//lib/prism/node.rb#14020 + # source://prism//lib/prism/node.rb#12167 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # attr_reader depth: Integer + # + # source://prism//lib/prism/node.rb#12175 + sig { returns(Integer) } + def depth; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#14025 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#12178 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # attr_reader name: Symbol # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#12172 + sig { returns(Symbol) } + def name; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#14044 + # source://prism//lib/prism/node.rb#12183 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#14054 + # source://prism//lib/prism/node.rb#12188 def type; end end end -# Represents a module declaration involving the `module` keyword. +# Represents writing to a local variable. # -# module Foo end -# ^^^^^^^^^^^^^^ +# foo = 1 +# ^^^^^^^ # -# source://prism//lib/prism/node.rb#14069 -class Prism::ModuleNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, Location module_keyword_loc, Prism::node constant_path, Prism::node? body, Location end_keyword_loc, Symbol name, Location location) -> void +# source://prism//lib/prism/node.rb#12205 +class Prism::LocalVariableWriteNode < ::Prism::Node + # Initialize a new LocalVariableWriteNode node. # - # @return [ModuleNode] a new instance of ModuleNode + # @return [LocalVariableWriteNode] a new instance of LocalVariableWriteNode # - # source://prism//lib/prism/node.rb#14071 + # source://prism//lib/prism/node.rb#12207 sig do params( source: Prism::Source, - locals: T::Array[Symbol], - module_keyword_loc: Prism::Location, - constant_path: Prism::Node, - body: T.nilable(Prism::Node), - end_keyword_loc: Prism::Location, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, - location: Prism::Location + depth: Integer, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location ).void end - def initialize(source, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location); end + def initialize(source, node_id, location, flags, name, depth, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#14203 + # source://prism//lib/prism/node.rb#12335 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#14084 + # source://prism//lib/prism/node.rb#12220 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? - # - # source://prism//lib/prism/node.rb#14133 - sig { returns(T.nilable(Prism::Node)) } - def body; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14089 + # source://prism//lib/prism/node.rb#12225 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#14102 + # source://prism//lib/prism/node.rb#12235 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#14094 + # source://prism//lib/prism/node.rb#12230 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader constant_path: Prism::node - # - # source://prism//lib/prism/node.rb#14130 - sig { returns(Prism::Node) } - def constant_path; end - - # def copy: (?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: Prism::node, ?body: Prism::node?, ?end_keyword_loc: Location, ?name: Symbol, ?location: Location) -> ModuleNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode # - # source://prism//lib/prism/node.rb#14107 + # source://prism//lib/prism/node.rb#12240 sig do params( - locals: T::Array[Symbol], - module_keyword_loc: Prism::Location, - constant_path: Prism::Node, - body: T.nilable(Prism::Node), - end_keyword_loc: Prism::Location, + node_id: Integer, + location: Prism::Location, + flags: Integer, name: Symbol, - location: Prism::Location - ).returns(Prism::ModuleNode) + depth: Integer, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::LocalVariableWriteNode) end - def copy(locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14089 + # source://prism//lib/prism/node.rb#12225 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], module_keyword_loc: Location, constant_path: Prism::node, body: Prism::node?, end_keyword_loc: Location, name: Symbol, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer, name_loc: Location, value: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#14115 + # source://prism//lib/prism/node.rb#12248 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def end_keyword: () -> String + # The number of semantic scopes we have to traverse to find the declaration of this variable. # - # source://prism//lib/prism/node.rb#14151 - sig { returns(String) } - def end_keyword; end - - # attr_reader end_keyword_loc: Location + # foo = 1 # depth 0 # - # source://prism//lib/prism/node.rb#14136 - sig { returns(Prism::Location) } - def end_keyword_loc; end + # tap { foo = 1 } # depth 1 + # + # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). + # + # source://prism//lib/prism/node.rb#12266 + sig { returns(Integer) } + def depth; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#14156 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#12319 + sig { override.returns(String) } + def inspect; end - # attr_reader locals: Array[Symbol] + # The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). # - # source://prism//lib/prism/node.rb#14120 - sig { returns(T::Array[Symbol]) } - def locals; end + # foo = :bar # name `:foo` + # + # abc = 123 # name `:abc` + # + # source://prism//lib/prism/node.rb#12257 + sig { returns(Symbol) } + def name; end - # def module_keyword: () -> String + # The location of the variable name. # - # source://prism//lib/prism/node.rb#14146 + # foo = :bar + # ^^^ + # + # source://prism//lib/prism/node.rb#12272 + sig { returns(Prism::Location) } + def name_loc; end + + # def operator: () -> String + # + # source://prism//lib/prism/node.rb#12314 sig { returns(String) } - def module_keyword; end + def operator; end - # attr_reader module_keyword_loc: Location + # The location of the `=` operator. # - # source://prism//lib/prism/node.rb#14123 + # x = :y + # ^ + # + # source://prism//lib/prism/node.rb#12301 sig { returns(Prism::Location) } - def module_keyword_loc; end + def operator_loc; end - # attr_reader name: Symbol + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#14143 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/node.rb#12280 + def save_name_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#12309 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#14187 + # source://prism//lib/prism/node.rb#12324 sig { override.returns(Symbol) } def type; end + # The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # + # foo = :bar + # ^^^^ + # + # abc = 1234 + # ^^^^ + # + # Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write. + # + # foo = foo + # + # source://prism//lib/prism/node.rb#12295 + sig { returns(Prism::Node) } + def value; end + class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14197 + # source://prism//lib/prism/node.rb#12329 def type; end end end -# Represents a multi-target expression. -# -# a, (b, c) = 1, 2, 3 -# ^^^^^^ +# This represents a location in the source. # -# source://prism//lib/prism/node.rb#14219 -class Prism::MultiTargetNode < ::Prism::Node - # def initialize: (Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode] lefts, Prism::node? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode] rights, Location? lparen_loc, Location? rparen_loc, Location location) -> void +# source://prism//lib/prism/parse_result.rb#290 +class Prism::Location + # Create a new location object with the given source, start byte offset, and + # byte length. # - # @return [MultiTargetNode] a new instance of MultiTargetNode + # @return [Location] a new instance of Location # - # source://prism//lib/prism/node.rb#14221 - sig do - params( - source: Prism::Source, - lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], - rest: T.nilable(Prism::Node), - rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode)], - lparen_loc: T.nilable(Prism::Location), - rparen_loc: T.nilable(Prism::Location), - location: Prism::Location - ).void - end - def initialize(source, lefts, rest, rights, lparen_loc, rparen_loc, location); end + # source://prism//lib/prism/parse_result.rb#305 + sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void } + def initialize(source, start_offset, length); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Returns true if the given other location is equal to this location. # - # source://prism//lib/prism/node.rb#14360 - def ===(other); end + # source://prism//lib/prism/parse_result.rb#493 + sig { params(other: T.untyped).returns(T::Boolean) } + def ==(other); end - # def accept: (Visitor visitor) -> void + # Join this location with the first occurrence of the string in the source + # that occurs after this location on the same line, and return the new + # location. This will raise an error if the string does not exist. # - # source://prism//lib/prism/node.rb#14233 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/parse_result.rb#512 + sig { params(string: String).returns(Prism::Location) } + def adjoin(string); end - # def child_nodes: () -> Array[nil | Node] + # The end column in code units using the given cache to fetch or calculate + # the value. # - # source://prism//lib/prism/node.rb#14238 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/parse_result.rb#478 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_end_code_units_column(cache); end - # def comment_targets: () -> Array[Node | Location] + # The end offset from the start of the file in code units using the given + # cache to fetch or calculate the value. # - # source://prism//lib/prism/node.rb#14252 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/parse_result.rb#414 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_end_code_units_offset(cache); end - # def compact_child_nodes: () -> Array[Node] + # The start column in code units using the given cache to fetch or calculate + # the value. # - # source://prism//lib/prism/node.rb#14243 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/parse_result.rb#454 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_start_code_units_column(cache); end - # def copy: (?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], ?rest: Prism::node?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?location: Location) -> MultiTargetNode + # The start offset from the start of the file in code units using the given + # cache to fetch or calculate the value. # - # source://prism//lib/prism/node.rb#14257 + # source://prism//lib/prism/parse_result.rb#392 sig do params( - lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], - rest: T.nilable(Prism::Node), - rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode)], - lparen_loc: T.nilable(Prism::Location), - rparen_loc: T.nilable(Prism::Location), - location: Prism::Location - ).returns(Prism::MultiTargetNode) + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) end - def copy(lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def cached_start_code_units_offset(cache); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Returns a new location that is the result of chopping off the last byte. # - # source://prism//lib/prism/node.rb#14238 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/parse_result.rb#351 + sig { returns(Prism::Location) } + def chop; end - # def deconstruct_keys: (Array[Symbol] keys) -> { lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], rest: Prism::node?, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode], lparen_loc: Location?, rparen_loc: Location?, location: Location } + # Returns all comments that are associated with this location (both leading + # and trailing comments). # - # source://prism//lib/prism/node.rb#14265 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end - - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # source://prism//lib/prism/parse_result.rb#341 + sig { returns(T::Array[Prism::Comment]) } + def comments; end - # def inspect(NodeInspector inspector) -> String + # Create a new location object with the given options. # - # source://prism//lib/prism/node.rb#14315 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#346 + sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) } + def copy(source: T.unsafe(nil), start_offset: T.unsafe(nil), length: T.unsafe(nil)); end - # attr_reader lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode] + # Implement the hash pattern matching interface for Location. # - # source://prism//lib/prism/node.rb#14270 - sig do - returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) - end - def lefts; end + # source://prism//lib/prism/parse_result.rb#483 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # def lparen: () -> String? + # The column number in characters where this location ends from the start of + # the line. # - # source://prism//lib/prism/node.rb#14305 - sig { returns(T.nilable(String)) } - def lparen; end + # source://prism//lib/prism/parse_result.rb#466 + sig { returns(Integer) } + def end_character_column; end - # attr_reader lparen_loc: Location? + # The character offset from the beginning of the source where this location + # ends. # - # source://prism//lib/prism/node.rb#14279 - sig { returns(T.nilable(Prism::Location)) } - def lparen_loc; end + # source://prism//lib/prism/parse_result.rb#403 + sig { returns(Integer) } + def end_character_offset; end - # attr_reader rest: Prism::node? + # The column number in code units of the given encoding where this location + # ends from the start of the line. # - # source://prism//lib/prism/node.rb#14273 - sig { returns(T.nilable(Prism::Node)) } - def rest; end + # source://prism//lib/prism/parse_result.rb#472 + sig { params(encoding: Encoding).returns(Integer) } + def end_code_units_column(encoding = T.unsafe(nil)); end - # attr_reader rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode] + # The offset from the start of the file in code units of the given encoding. # - # source://prism//lib/prism/node.rb#14276 - sig do - returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode)]) - end - def rights; end + # source://prism//lib/prism/parse_result.rb#408 + sig { params(encoding: Encoding).returns(Integer) } + def end_code_units_offset(encoding = T.unsafe(nil)); end - # def rparen: () -> String? + # The column number in bytes where this location ends from the start of the + # line. # - # source://prism//lib/prism/node.rb#14310 - sig { returns(T.nilable(String)) } - def rparen; end + # source://prism//lib/prism/parse_result.rb#460 + sig { returns(Integer) } + def end_column; end - # attr_reader rparen_loc: Location? + # The line number where this location ends. # - # source://prism//lib/prism/node.rb#14292 - sig { returns(T.nilable(Prism::Location)) } - def rparen_loc; end + # source://prism//lib/prism/parse_result.rb#430 + sig { returns(Integer) } + def end_line; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # The byte offset from the beginning of the source where this location ends. # - # source://prism//lib/prism/node.rb#14344 - sig { override.returns(Symbol) } - def type; end - - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14354 - def type; end - end -end + # source://prism//lib/prism/parse_result.rb#397 + sig { returns(Integer) } + def end_offset; end -# Represents a write to a multi-target expression. -# -# a, b, c = 1, 2, 3 -# ^^^^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#14376 -class Prism::MultiWriteNode < ::Prism::Node - # def initialize: (Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, Prism::node? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value, Location location) -> void + # Returns a string representation of this location. # - # @return [MultiWriteNode] a new instance of MultiWriteNode + # source://prism//lib/prism/parse_result.rb#356 + sig { returns(String) } + def inspect; end + + # Returns a new location that stretches from this location to the given + # other location. Raises an error if this location is not before the other + # location or if they don't share the same source. # - # source://prism//lib/prism/node.rb#14378 - sig do - params( - source: Prism::Source, - lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)], - rest: T.nilable(Prism::Node), - rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)], - lparen_loc: T.nilable(Prism::Location), - rparen_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).void - end - def initialize(source, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value, location); end + # source://prism//lib/prism/parse_result.rb#502 + sig { params(other: Prism::Location).returns(Prism::Location) } + def join(other); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Attach a comment to the leading comments of this location. # - # source://prism//lib/prism/node.rb#14538 - def ===(other); end + # source://prism//lib/prism/parse_result.rb#324 + sig { params(comment: Prism::Comment).void } + def leading_comment(comment); end - # def accept: (Visitor visitor) -> void + # These are the comments that are associated with this location that exist + # before the start of this location. # - # source://prism//lib/prism/node.rb#14392 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/parse_result.rb#319 + sig { returns(T::Array[Prism::Comment]) } + def leading_comments; end - # def child_nodes: () -> Array[nil | Node] + # The length of this location in bytes. # - # source://prism//lib/prism/node.rb#14397 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/parse_result.rb#301 + sig { returns(Integer) } + def length; end - # def comment_targets: () -> Array[Node | Location] + # Implement the pretty print interface for Location. # - # source://prism//lib/prism/node.rb#14412 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/parse_result.rb#488 + sig { params(q: T.untyped).void } + def pretty_print(q); end - # def compact_child_nodes: () -> Array[Node] + # The source code that this location represents. # - # source://prism//lib/prism/node.rb#14402 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/parse_result.rb#366 + sig { returns(String) } + def slice; end - # def copy: (?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: Prism::node?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> MultiWriteNode + # The source code that this location represents starting from the beginning + # of the line that this location starts on to the end of the line that this + # location ends on. # - # source://prism//lib/prism/node.rb#14417 - sig do - params( - lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)], - rest: T.nilable(Prism::Node), - rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)], - lparen_loc: T.nilable(Prism::Location), - rparen_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).returns(Prism::MultiWriteNode) - end - def copy(lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#373 + def slice_lines; end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Returns all of the lines of the source code associated with this location. # - # source://prism//lib/prism/node.rb#14397 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/parse_result.rb#361 + sig { returns(T::Array[String]) } + def source_lines; end - # def deconstruct_keys: (Array[Symbol] keys) -> { lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], rest: Prism::node?, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Prism::node, location: Location } + # The column number in characters where this location ends from the start of + # the line. # - # source://prism//lib/prism/node.rb#14425 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/parse_result.rb#442 + sig { returns(Integer) } + def start_character_column; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # The character offset from the beginning of the source where this location + # starts. + # + # source://prism//lib/prism/parse_result.rb#381 + sig { returns(Integer) } + def start_character_offset; end - # def inspect(NodeInspector inspector) -> String + # The column number in code units of the given encoding where this location + # starts from the start of the line. # - # source://prism//lib/prism/node.rb#14490 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#448 + sig { params(encoding: Encoding).returns(Integer) } + def start_code_units_column(encoding = T.unsafe(nil)); end - # attr_reader lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] + # The offset from the start of the file in code units of the given encoding. # - # source://prism//lib/prism/node.rb#14430 - sig do - returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)]) - end - def lefts; end + # source://prism//lib/prism/parse_result.rb#386 + sig { params(encoding: Encoding).returns(Integer) } + def start_code_units_offset(encoding = T.unsafe(nil)); end - # def lparen: () -> String? + # The column number in bytes where this location starts from the start of + # the line. # - # source://prism//lib/prism/node.rb#14475 - sig { returns(T.nilable(String)) } - def lparen; end + # source://prism//lib/prism/parse_result.rb#436 + sig { returns(Integer) } + def start_column; end - # attr_reader lparen_loc: Location? + # The line number where this location starts. # - # source://prism//lib/prism/node.rb#14439 - sig { returns(T.nilable(Prism::Location)) } - def lparen_loc; end + # source://prism//lib/prism/parse_result.rb#419 + sig { returns(Integer) } + def start_line; end - # def operator: () -> String + # The content of the line where this location starts before this location. # - # source://prism//lib/prism/node.rb#14485 + # source://prism//lib/prism/parse_result.rb#424 sig { returns(String) } - def operator; end + def start_line_slice; end - # attr_reader operator_loc: Location + # The byte offset from the beginning of the source where this location + # starts. # - # source://prism//lib/prism/node.rb#14465 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/parse_result.rb#298 + sig { returns(Integer) } + def start_offset; end - # attr_reader rest: Prism::node? + # Attach a comment to the trailing comments of this location. # - # source://prism//lib/prism/node.rb#14433 - sig { returns(T.nilable(Prism::Node)) } - def rest; end + # source://prism//lib/prism/parse_result.rb#335 + sig { params(comment: Prism::Comment).void } + def trailing_comment(comment); end - # attr_reader rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] + # These are the comments that are associated with this location that exist + # after the end of this location. # - # source://prism//lib/prism/node.rb#14436 - sig do - returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode)]) - end - def rights; end - - # def rparen: () -> String? - # - # source://prism//lib/prism/node.rb#14480 - sig { returns(T.nilable(String)) } - def rparen; end + # source://prism//lib/prism/parse_result.rb#330 + sig { returns(T::Array[Prism::Comment]) } + def trailing_comments; end - # attr_reader rparen_loc: Location? - # - # source://prism//lib/prism/node.rb#14452 - sig { returns(T.nilable(Prism::Location)) } - def rparen_loc; end + protected - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # A Source object that is used to determine more information from the given + # offset and length. # - # source://prism//lib/prism/node.rb#14522 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/parse_result.rb#293 + sig { returns(Prism::Source) } + def source; end +end - # attr_reader value: Prism::node - # - # source://prism//lib/prism/node.rb#14472 - sig { returns(Prism::Node) } - def value; end +# Flags for while and until loop nodes. +# +# source://prism//lib/prism/node.rb#18537 +module Prism::LoopFlags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14532 - def type; end - end -end +# a loop after a begin statement, so the body is executed first before the condition +# +# source://prism//lib/prism/node.rb#18539 +Prism::LoopFlags::BEGIN_MODIFIER = T.let(T.unsafe(nil), Integer) -# This visitor walks through the tree and copies each node as it is being -# visited. This is useful for consumers that want to mutate the tree, as you -# can change subtrees in place without effecting the rest of the tree. +# This represents a magic comment that was encountered during parsing. # -# source://prism//lib/prism/mutation_compiler.rb#13 -class Prism::MutationCompiler < ::Prism::Compiler - # Copy a AliasGlobalVariableNode node +# source://prism//lib/prism/parse_result.rb#574 +class Prism::MagicComment + # Create a new magic comment object with the given key and value locations. # - # source://prism//lib/prism/mutation_compiler.rb#15 - def visit_alias_global_variable_node(node); end - - # Copy a AliasMethodNode node + # @return [MagicComment] a new instance of MagicComment # - # source://prism//lib/prism/mutation_compiler.rb#20 - def visit_alias_method_node(node); end + # source://prism//lib/prism/parse_result.rb#582 + sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void } + def initialize(key_loc, value_loc); end - # Copy a AlternationPatternNode node + # Implement the hash pattern matching interface for MagicComment. # - # source://prism//lib/prism/mutation_compiler.rb#25 - def visit_alternation_pattern_node(node); end + # source://prism//lib/prism/parse_result.rb#598 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a AndNode node + # Returns a string representation of this magic comment. # - # source://prism//lib/prism/mutation_compiler.rb#30 - def visit_and_node(node); end + # source://prism//lib/prism/parse_result.rb#603 + sig { returns(String) } + def inspect; end - # Copy a ArgumentsNode node + # Returns the key of the magic comment by slicing it from the source code. # - # source://prism//lib/prism/mutation_compiler.rb#35 - def visit_arguments_node(node); end + # source://prism//lib/prism/parse_result.rb#588 + sig { returns(String) } + def key; end - # Copy a ArrayNode node + # A Location object representing the location of the key in the source. # - # source://prism//lib/prism/mutation_compiler.rb#40 - def visit_array_node(node); end + # source://prism//lib/prism/parse_result.rb#576 + sig { returns(Prism::Location) } + def key_loc; end - # Copy a ArrayPatternNode node + # Returns the value of the magic comment by slicing it from the source code. # - # source://prism//lib/prism/mutation_compiler.rb#45 - def visit_array_pattern_node(node); end + # source://prism//lib/prism/parse_result.rb#593 + sig { returns(String) } + def value; end - # Copy a AssocNode node + # A Location object representing the location of the value in the source. # - # source://prism//lib/prism/mutation_compiler.rb#50 - def visit_assoc_node(node); end + # source://prism//lib/prism/parse_result.rb#579 + sig { returns(Prism::Location) } + def value_loc; end +end - # Copy a AssocSplatNode node - # - # source://prism//lib/prism/mutation_compiler.rb#55 - def visit_assoc_splat_node(node); end +# Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object. +# +# if /foo/i then end +# ^^^^^^ +# +# source://prism//lib/prism/node.rb#12349 +class Prism::MatchLastLineNode < ::Prism::Node + include ::Prism::RegularExpressionOptions - # Copy a BackReferenceReadNode node + # Initialize a new MatchLastLineNode node. # - # source://prism//lib/prism/mutation_compiler.rb#60 - def visit_back_reference_read_node(node); end - - # Copy a BeginNode node + # @return [MatchLastLineNode] a new instance of MatchLastLineNode # - # source://prism//lib/prism/mutation_compiler.rb#65 - def visit_begin_node(node); end + # source://prism//lib/prism/node.rb#12351 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).void + end + def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end - # Copy a BlockArgumentNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#70 - def visit_block_argument_node(node); end + # source://prism//lib/prism/node.rb#12524 + def ===(other); end - # Copy a BlockLocalVariableNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#75 - def visit_block_local_variable_node(node); end + # source://prism//lib/prism/node.rb#12363 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a BlockNode node + # def ascii_8bit?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#80 - def visit_block_node(node); end - - # Copy a BlockParameterNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#85 - def visit_block_parameter_node(node); end + # source://prism//lib/prism/node.rb#12421 + sig { returns(T::Boolean) } + def ascii_8bit?; end - # Copy a BlockParametersNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#90 - def visit_block_parameters_node(node); end + # source://prism//lib/prism/node.rb#12368 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a BreakNode node + # def closing: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#95 - def visit_break_node(node); end + # source://prism//lib/prism/node.rb#12503 + sig { returns(String) } + def closing; end - # Copy a CallAndWriteNode node + # attr_reader closing_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#100 - def visit_call_and_write_node(node); end + # source://prism//lib/prism/node.rb#12477 + sig { returns(Prism::Location) } + def closing_loc; end - # Copy a CallNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#105 - def visit_call_node(node); end + # source://prism//lib/prism/node.rb#12378 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a CallOperatorWriteNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#110 - def visit_call_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12373 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a CallOrWriteNode node + # def content: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#115 - def visit_call_or_write_node(node); end + # source://prism//lib/prism/node.rb#12498 + sig { returns(String) } + def content; end - # Copy a CallTargetNode node + # attr_reader content_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#120 - def visit_call_target_node(node); end + # source://prism//lib/prism/node.rb#12464 + sig { returns(Prism::Location) } + def content_loc; end - # Copy a CapturePatternNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode # - # source://prism//lib/prism/mutation_compiler.rb#125 - def visit_capture_pattern_node(node); end + # source://prism//lib/prism/node.rb#12383 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).returns(Prism::MatchLastLineNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end - # Copy a CaseMatchNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#130 - def visit_case_match_node(node); end + # source://prism//lib/prism/node.rb#12368 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a CaseNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String } # - # source://prism//lib/prism/mutation_compiler.rb#135 - def visit_case_node(node); end + # source://prism//lib/prism/node.rb#12391 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a ClassNode node + # def euc_jp?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#140 - def visit_class_node(node); end - - # Copy a ClassVariableAndWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#145 - def visit_class_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#12416 + sig { returns(T::Boolean) } + def euc_jp?; end - # Copy a ClassVariableOperatorWriteNode node + # def extended?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#150 - def visit_class_variable_operator_write_node(node); end - - # Copy a ClassVariableOrWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#155 - def visit_class_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#12401 + sig { returns(T::Boolean) } + def extended?; end - # Copy a ClassVariableReadNode node - # - # source://prism//lib/prism/mutation_compiler.rb#160 - def visit_class_variable_read_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a ClassVariableTargetNode node + # def forced_binary_encoding?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#165 - def visit_class_variable_target_node(node); end - - # Copy a ClassVariableWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#170 - def visit_class_variable_write_node(node); end + # source://prism//lib/prism/node.rb#12441 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end - # Copy a ConstantAndWriteNode node + # def forced_us_ascii_encoding?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#175 - def visit_constant_and_write_node(node); end - - # Copy a ConstantOperatorWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#180 - def visit_constant_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12446 + sig { returns(T::Boolean) } + def forced_us_ascii_encoding?; end - # Copy a ConstantOrWriteNode node + # def forced_utf8_encoding?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#185 - def visit_constant_or_write_node(node); end - - # Copy a ConstantPathAndWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#190 - def visit_constant_path_and_write_node(node); end + # source://prism//lib/prism/node.rb#12436 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # Copy a ConstantPathNode node + # def ignore_case?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#195 - def visit_constant_path_node(node); end - - # Copy a ConstantPathOperatorWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#200 - def visit_constant_path_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12396 + sig { returns(T::Boolean) } + def ignore_case?; end - # Copy a ConstantPathOrWriteNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#205 - def visit_constant_path_or_write_node(node); end + # source://prism//lib/prism/node.rb#12508 + sig { override.returns(String) } + def inspect; end - # Copy a ConstantPathTargetNode node + # def multi_line?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#210 - def visit_constant_path_target_node(node); end - - # Copy a ConstantPathWriteNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#215 - def visit_constant_path_write_node(node); end + # source://prism//lib/prism/node.rb#12406 + sig { returns(T::Boolean) } + def multi_line?; end - # Copy a ConstantReadNode node + # def once?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#220 - def visit_constant_read_node(node); end - - # Copy a ConstantTargetNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#225 - def visit_constant_target_node(node); end + # source://prism//lib/prism/node.rb#12411 + sig { returns(T::Boolean) } + def once?; end - # Copy a ConstantWriteNode node + # def opening: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#230 - def visit_constant_write_node(node); end + # source://prism//lib/prism/node.rb#12493 + sig { returns(String) } + def opening; end - # Copy a DefNode node + # attr_reader opening_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#235 - def visit_def_node(node); end + # source://prism//lib/prism/node.rb#12451 + sig { returns(Prism::Location) } + def opening_loc; end - # Copy a DefinedNode node - # - # source://prism//lib/prism/mutation_compiler.rb#240 - def visit_defined_node(node); end + sig { returns(Integer) } + def options; end - # Copy a ElseNode node + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#245 - def visit_else_node(node); end + # source://prism//lib/prism/node.rb#12485 + def save_closing_loc(repository); end - # Copy a EmbeddedStatementsNode node + # Save the content_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#250 - def visit_embedded_statements_node(node); end + # source://prism//lib/prism/node.rb#12472 + def save_content_loc(repository); end - # Copy a EmbeddedVariableNode node + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#255 - def visit_embedded_variable_node(node); end + # source://prism//lib/prism/node.rb#12459 + def save_opening_loc(repository); end - # Copy a EnsureNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#260 - def visit_ensure_node(node); end + # source://prism//lib/prism/node.rb#12513 + sig { override.returns(Symbol) } + def type; end - # Copy a FalseNode node + # attr_reader unescaped: String # - # source://prism//lib/prism/mutation_compiler.rb#265 - def visit_false_node(node); end + # source://prism//lib/prism/node.rb#12490 + sig { returns(String) } + def unescaped; end - # Copy a FindPatternNode node + # def utf_8?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#270 - def visit_find_pattern_node(node); end - - # Copy a FlipFlopNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#275 - def visit_flip_flop_node(node); end + # source://prism//lib/prism/node.rb#12431 + sig { returns(T::Boolean) } + def utf_8?; end - # Copy a FloatNode node + # def windows_31j?: () -> bool # - # source://prism//lib/prism/mutation_compiler.rb#280 - def visit_float_node(node); end - - # Copy a ForNode node + # @return [Boolean] # - # source://prism//lib/prism/mutation_compiler.rb#285 - def visit_for_node(node); end + # source://prism//lib/prism/node.rb#12426 + sig { returns(T::Boolean) } + def windows_31j?; end - # Copy a ForwardingArgumentsNode node - # - # source://prism//lib/prism/mutation_compiler.rb#290 - def visit_forwarding_arguments_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12518 + def type; end + end +end - # Copy a ForwardingParameterNode node +# Represents the use of the modifier `in` operator. +# +# foo in bar +# ^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#12538 +class Prism::MatchPredicateNode < ::Prism::Node + # Initialize a new MatchPredicateNode node. # - # source://prism//lib/prism/mutation_compiler.rb#295 - def visit_forwarding_parameter_node(node); end - - # Copy a ForwardingSuperNode node + # @return [MatchPredicateNode] a new instance of MatchPredicateNode # - # source://prism//lib/prism/mutation_compiler.rb#300 - def visit_forwarding_super_node(node); end + # source://prism//lib/prism/node.rb#12540 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, value, pattern, operator_loc); end - # Copy a GlobalVariableAndWriteNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#305 - def visit_global_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#12624 + def ===(other); end - # Copy a GlobalVariableOperatorWriteNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#310 - def visit_global_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12551 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a GlobalVariableOrWriteNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#315 - def visit_global_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#12556 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a GlobalVariableReadNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#320 - def visit_global_variable_read_node(node); end + # source://prism//lib/prism/node.rb#12566 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a GlobalVariableTargetNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#325 - def visit_global_variable_target_node(node); end + # source://prism//lib/prism/node.rb#12561 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a GlobalVariableWriteNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode # - # source://prism//lib/prism/mutation_compiler.rb#330 - def visit_global_variable_write_node(node); end + # source://prism//lib/prism/node.rb#12571 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchPredicateNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Copy a HashNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#335 - def visit_hash_node(node); end + # source://prism//lib/prism/node.rb#12556 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a HashPatternNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, pattern: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/mutation_compiler.rb#340 - def visit_hash_pattern_node(node); end + # source://prism//lib/prism/node.rb#12579 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a IfNode node - # - # source://prism//lib/prism/mutation_compiler.rb#345 - def visit_if_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a ImaginaryNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#350 - def visit_imaginary_node(node); end + # source://prism//lib/prism/node.rb#12608 + sig { override.returns(String) } + def inspect; end - # Copy a ImplicitNode node + # def operator: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#355 - def visit_implicit_node(node); end + # source://prism//lib/prism/node.rb#12603 + sig { returns(String) } + def operator; end - # Copy a ImplicitRestNode node + # attr_reader operator_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#360 - def visit_implicit_rest_node(node); end + # source://prism//lib/prism/node.rb#12590 + sig { returns(Prism::Location) } + def operator_loc; end - # Copy a InNode node + # attr_reader pattern: Prism::node # - # source://prism//lib/prism/mutation_compiler.rb#365 - def visit_in_node(node); end + # source://prism//lib/prism/node.rb#12587 + sig { returns(Prism::Node) } + def pattern; end - # Copy a IndexAndWriteNode node + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#370 - def visit_index_and_write_node(node); end + # source://prism//lib/prism/node.rb#12598 + def save_operator_loc(repository); end - # Copy a IndexOperatorWriteNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#375 - def visit_index_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12613 + sig { override.returns(Symbol) } + def type; end - # Copy a IndexOrWriteNode node + # attr_reader value: Prism::node # - # source://prism//lib/prism/mutation_compiler.rb#380 - def visit_index_or_write_node(node); end + # source://prism//lib/prism/node.rb#12584 + sig { returns(Prism::Node) } + def value; end - # Copy a IndexTargetNode node - # - # source://prism//lib/prism/mutation_compiler.rb#385 - def visit_index_target_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12618 + def type; end + end +end - # Copy a InstanceVariableAndWriteNode node +# Represents the use of the `=>` operator. +# +# foo => bar +# ^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#12636 +class Prism::MatchRequiredNode < ::Prism::Node + # Initialize a new MatchRequiredNode node. # - # source://prism//lib/prism/mutation_compiler.rb#390 - def visit_instance_variable_and_write_node(node); end - - # Copy a InstanceVariableOperatorWriteNode node + # @return [MatchRequiredNode] a new instance of MatchRequiredNode # - # source://prism//lib/prism/mutation_compiler.rb#395 - def visit_instance_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12638 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, value, pattern, operator_loc); end - # Copy a InstanceVariableOrWriteNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#400 - def visit_instance_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#12722 + def ===(other); end - # Copy a InstanceVariableReadNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#405 - def visit_instance_variable_read_node(node); end + # source://prism//lib/prism/node.rb#12649 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a InstanceVariableTargetNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#410 - def visit_instance_variable_target_node(node); end + # source://prism//lib/prism/node.rb#12654 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a InstanceVariableWriteNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#415 - def visit_instance_variable_write_node(node); end + # source://prism//lib/prism/node.rb#12664 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a IntegerNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#420 - def visit_integer_node(node); end + # source://prism//lib/prism/node.rb#12659 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a InterpolatedMatchLastLineNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode # - # source://prism//lib/prism/mutation_compiler.rb#425 - def visit_interpolated_match_last_line_node(node); end + # source://prism//lib/prism/node.rb#12669 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchRequiredNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end - # Copy a InterpolatedRegularExpressionNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#430 - def visit_interpolated_regular_expression_node(node); end + # source://prism//lib/prism/node.rb#12654 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a InterpolatedStringNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, pattern: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/mutation_compiler.rb#435 - def visit_interpolated_string_node(node); end + # source://prism//lib/prism/node.rb#12677 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a InterpolatedSymbolNode node - # - # source://prism//lib/prism/mutation_compiler.rb#440 - def visit_interpolated_symbol_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a InterpolatedXStringNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#445 - def visit_interpolated_x_string_node(node); end + # source://prism//lib/prism/node.rb#12706 + sig { override.returns(String) } + def inspect; end - # Copy a ItParametersNode node + # def operator: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#450 - def visit_it_parameters_node(node); end + # source://prism//lib/prism/node.rb#12701 + sig { returns(String) } + def operator; end - # Copy a KeywordHashNode node + # attr_reader operator_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#455 - def visit_keyword_hash_node(node); end + # source://prism//lib/prism/node.rb#12688 + sig { returns(Prism::Location) } + def operator_loc; end - # Copy a KeywordRestParameterNode node + # attr_reader pattern: Prism::node # - # source://prism//lib/prism/mutation_compiler.rb#460 - def visit_keyword_rest_parameter_node(node); end + # source://prism//lib/prism/node.rb#12685 + sig { returns(Prism::Node) } + def pattern; end - # Copy a LambdaNode node + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#465 - def visit_lambda_node(node); end + # source://prism//lib/prism/node.rb#12696 + def save_operator_loc(repository); end - # Copy a LocalVariableAndWriteNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#470 - def visit_local_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#12711 + sig { override.returns(Symbol) } + def type; end - # Copy a LocalVariableOperatorWriteNode node + # attr_reader value: Prism::node # - # source://prism//lib/prism/mutation_compiler.rb#475 - def visit_local_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#12682 + sig { returns(Prism::Node) } + def value; end - # Copy a LocalVariableOrWriteNode node - # - # source://prism//lib/prism/mutation_compiler.rb#480 - def visit_local_variable_or_write_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12716 + def type; end + end +end - # Copy a LocalVariableReadNode node +# Represents writing local variables using a regular expression match with named capture groups. +# +# /(?bar)/ =~ baz +# ^^^^^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#12734 +class Prism::MatchWriteNode < ::Prism::Node + # Initialize a new MatchWriteNode node. # - # source://prism//lib/prism/mutation_compiler.rb#485 - def visit_local_variable_read_node(node); end - - # Copy a LocalVariableTargetNode node + # @return [MatchWriteNode] a new instance of MatchWriteNode # - # source://prism//lib/prism/mutation_compiler.rb#490 - def visit_local_variable_target_node(node); end + # source://prism//lib/prism/node.rb#12736 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + call: Prism::CallNode, + targets: T::Array[Prism::LocalVariableTargetNode] + ).void + end + def initialize(source, node_id, location, flags, call, targets); end - # Copy a LocalVariableWriteNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#495 - def visit_local_variable_write_node(node); end + # source://prism//lib/prism/node.rb#12801 + def ===(other); end - # Copy a MatchLastLineNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#500 - def visit_match_last_line_node(node); end + # source://prism//lib/prism/node.rb#12746 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a MatchPredicateNode node + # attr_reader call: CallNode # - # source://prism//lib/prism/mutation_compiler.rb#505 - def visit_match_predicate_node(node); end + # source://prism//lib/prism/node.rb#12779 + sig { returns(Prism::CallNode) } + def call; end - # Copy a MatchRequiredNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#510 - def visit_match_required_node(node); end + # source://prism//lib/prism/node.rb#12751 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a MatchWriteNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#515 - def visit_match_write_node(node); end + # source://prism//lib/prism/node.rb#12761 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a MissingNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#520 - def visit_missing_node(node); end + # source://prism//lib/prism/node.rb#12756 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a ModuleNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode # - # source://prism//lib/prism/mutation_compiler.rb#525 - def visit_module_node(node); end + # source://prism//lib/prism/node.rb#12766 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + call: Prism::CallNode, + targets: T::Array[Prism::LocalVariableTargetNode] + ).returns(Prism::MatchWriteNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), call: T.unsafe(nil), targets: T.unsafe(nil)); end - # Copy a MultiTargetNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#530 - def visit_multi_target_node(node); end + # source://prism//lib/prism/node.rb#12751 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a MultiWriteNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, call: CallNode, targets: Array[LocalVariableTargetNode] } # - # source://prism//lib/prism/mutation_compiler.rb#535 - def visit_multi_write_node(node); end + # source://prism//lib/prism/node.rb#12774 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a NextNode node - # - # source://prism//lib/prism/mutation_compiler.rb#540 - def visit_next_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a NilNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#545 - def visit_nil_node(node); end + # source://prism//lib/prism/node.rb#12785 + sig { override.returns(String) } + def inspect; end - # Copy a NoKeywordsParameterNode node + # attr_reader targets: Array[LocalVariableTargetNode] # - # source://prism//lib/prism/mutation_compiler.rb#550 - def visit_no_keywords_parameter_node(node); end + # source://prism//lib/prism/node.rb#12782 + sig { returns(T::Array[Prism::LocalVariableTargetNode]) } + def targets; end - # Copy a NumberedParametersNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#555 - def visit_numbered_parameters_node(node); end + # source://prism//lib/prism/node.rb#12790 + sig { override.returns(Symbol) } + def type; end - # Copy a NumberedReferenceReadNode node - # - # source://prism//lib/prism/mutation_compiler.rb#560 - def visit_numbered_reference_read_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12795 + def type; end + end +end - # Copy a OptionalKeywordParameterNode node +# Represents a node that is missing from the source and results in a syntax error. +# +# source://prism//lib/prism/node.rb#12810 +class Prism::MissingNode < ::Prism::Node + # Initialize a new MissingNode node. # - # source://prism//lib/prism/mutation_compiler.rb#565 - def visit_optional_keyword_parameter_node(node); end - - # Copy a OptionalParameterNode node + # @return [MissingNode] a new instance of MissingNode # - # source://prism//lib/prism/mutation_compiler.rb#570 - def visit_optional_parameter_node(node); end + # source://prism//lib/prism/node.rb#12812 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end - # Copy a OrNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#575 - def visit_or_node(node); end - - # Copy a ParametersNode node - # - # source://prism//lib/prism/mutation_compiler.rb#580 - def visit_parameters_node(node); end - - # Copy a ParenthesesNode node - # - # source://prism//lib/prism/mutation_compiler.rb#585 - def visit_parentheses_node(node); end - - # Copy a PinnedExpressionNode node - # - # source://prism//lib/prism/mutation_compiler.rb#590 - def visit_pinned_expression_node(node); end + # source://prism//lib/prism/node.rb#12869 + def ===(other); end - # Copy a PinnedVariableNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#595 - def visit_pinned_variable_node(node); end + # source://prism//lib/prism/node.rb#12820 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a PostExecutionNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#600 - def visit_post_execution_node(node); end + # source://prism//lib/prism/node.rb#12825 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a PreExecutionNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#605 - def visit_pre_execution_node(node); end + # source://prism//lib/prism/node.rb#12835 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a ProgramNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#610 - def visit_program_node(node); end + # source://prism//lib/prism/node.rb#12830 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a RangeNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> MissingNode # - # source://prism//lib/prism/mutation_compiler.rb#615 - def visit_range_node(node); end + # source://prism//lib/prism/node.rb#12840 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::MissingNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # Copy a RationalNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#620 - def visit_rational_node(node); end + # source://prism//lib/prism/node.rb#12825 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a RedoNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/mutation_compiler.rb#625 - def visit_redo_node(node); end + # source://prism//lib/prism/node.rb#12848 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a RegularExpressionNode node - # - # source://prism//lib/prism/mutation_compiler.rb#630 - def visit_regular_expression_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a RequiredKeywordParameterNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#635 - def visit_required_keyword_parameter_node(node); end + # source://prism//lib/prism/node.rb#12853 + sig { override.returns(String) } + def inspect; end - # Copy a RequiredParameterNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#640 - def visit_required_parameter_node(node); end + # source://prism//lib/prism/node.rb#12858 + sig { override.returns(Symbol) } + def type; end - # Copy a RescueModifierNode node - # - # source://prism//lib/prism/mutation_compiler.rb#645 - def visit_rescue_modifier_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12863 + def type; end + end +end - # Copy a RescueNode node +# Represents a module declaration involving the `module` keyword. +# +# module Foo end +# ^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#12878 +class Prism::ModuleNode < ::Prism::Node + # Initialize a new ModuleNode node. # - # source://prism//lib/prism/mutation_compiler.rb#650 - def visit_rescue_node(node); end - - # Copy a RestParameterNode node + # @return [ModuleNode] a new instance of ModuleNode # - # source://prism//lib/prism/mutation_compiler.rb#655 - def visit_rest_parameter_node(node); end + # source://prism//lib/prism/node.rb#12880 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + module_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).void + end + def initialize(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name); end - # Copy a RetryNode node + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/mutation_compiler.rb#660 - def visit_retry_node(node); end + # source://prism//lib/prism/node.rb#12994 + def ===(other); end - # Copy a ReturnNode node + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/mutation_compiler.rb#665 - def visit_return_node(node); end + # source://prism//lib/prism/node.rb#12894 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Copy a SelfNode node + # attr_reader body: StatementsNode | BeginNode | nil # - # source://prism//lib/prism/mutation_compiler.rb#670 - def visit_self_node(node); end + # source://prism//lib/prism/node.rb#12949 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } + def body; end - # Copy a ShareableConstantNode node + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#675 - def visit_shareable_constant_node(node); end + # source://prism//lib/prism/node.rb#12899 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Copy a SingletonClassNode node + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/mutation_compiler.rb#680 - def visit_singleton_class_node(node); end + # source://prism//lib/prism/node.rb#12912 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Copy a SourceEncodingNode node + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/mutation_compiler.rb#685 - def visit_source_encoding_node(node); end + # source://prism//lib/prism/node.rb#12904 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Copy a SourceFileNode node + # attr_reader constant_path: ConstantReadNode | ConstantPathNode | MissingNode # - # source://prism//lib/prism/mutation_compiler.rb#690 - def visit_source_file_node(node); end + # source://prism//lib/prism/node.rb#12946 + sig { returns(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode)) } + def constant_path; end - # Copy a SourceLineNode node + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode | MissingNode, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode # - # source://prism//lib/prism/mutation_compiler.rb#695 - def visit_source_line_node(node); end + # source://prism//lib/prism/node.rb#12917 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + module_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).returns(Prism::ModuleNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end - # Copy a SplatNode node + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/mutation_compiler.rb#700 - def visit_splat_node(node); end + # source://prism//lib/prism/node.rb#12899 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Copy a StatementsNode node + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], module_keyword_loc: Location, constant_path: ConstantReadNode | ConstantPathNode | MissingNode, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location, name: Symbol } # - # source://prism//lib/prism/mutation_compiler.rb#705 - def visit_statements_node(node); end + # source://prism//lib/prism/node.rb#12925 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Copy a StringNode node + # def end_keyword: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#710 - def visit_string_node(node); end + # source://prism//lib/prism/node.rb#12973 + sig { returns(String) } + def end_keyword; end - # Copy a SuperNode node + # attr_reader end_keyword_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#715 - def visit_super_node(node); end + # source://prism//lib/prism/node.rb#12952 + sig { returns(Prism::Location) } + def end_keyword_loc; end - # Copy a SymbolNode node - # - # source://prism//lib/prism/mutation_compiler.rb#720 - def visit_symbol_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Copy a TrueNode node + # def inspect -> String # - # source://prism//lib/prism/mutation_compiler.rb#725 - def visit_true_node(node); end + # source://prism//lib/prism/node.rb#12978 + sig { override.returns(String) } + def inspect; end - # Copy a UndefNode node + # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/mutation_compiler.rb#730 - def visit_undef_node(node); end + # source://prism//lib/prism/node.rb#12930 + sig { returns(T::Array[Symbol]) } + def locals; end - # Copy a UnlessNode node + # def module_keyword: () -> String # - # source://prism//lib/prism/mutation_compiler.rb#735 - def visit_unless_node(node); end + # source://prism//lib/prism/node.rb#12968 + sig { returns(String) } + def module_keyword; end - # Copy a UntilNode node + # attr_reader module_keyword_loc: Location # - # source://prism//lib/prism/mutation_compiler.rb#740 - def visit_until_node(node); end + # source://prism//lib/prism/node.rb#12933 + sig { returns(Prism::Location) } + def module_keyword_loc; end - # Copy a WhenNode node + # attr_reader name: Symbol # - # source://prism//lib/prism/mutation_compiler.rb#745 - def visit_when_node(node); end + # source://prism//lib/prism/node.rb#12965 + sig { returns(Symbol) } + def name; end - # Copy a WhileNode node + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#750 - def visit_while_node(node); end + # source://prism//lib/prism/node.rb#12960 + def save_end_keyword_loc(repository); end - # Copy a XStringNode node + # Save the module_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/mutation_compiler.rb#755 - def visit_x_string_node(node); end + # source://prism//lib/prism/node.rb#12941 + def save_module_keyword_loc(repository); end - # Copy a YieldNode node + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/mutation_compiler.rb#760 - def visit_yield_node(node); end + # source://prism//lib/prism/node.rb#12983 + sig { override.returns(Symbol) } + def type; end - Result = type_member + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#12988 + def type; end + end end -# Represents the use of the `next` keyword. +# Represents a multi-target expression. # -# next 1 -# ^^^^^^ +# a, (b, c) = 1, 2, 3 +# ^^^^^^ # -# source://prism//lib/prism/node.rb#14556 -class Prism::NextNode < ::Prism::Node - # def initialize: (ArgumentsNode? arguments, Location keyword_loc, Location location) -> void +# This can be a part of `MultiWriteNode` as above, or the target of a `for` loop +# +# for a, b in [[1, 2], [3, 4]] +# ^^^^ +# +# source://prism//lib/prism/node.rb#13015 +class Prism::MultiTargetNode < ::Prism::Node + # Initialize a new MultiTargetNode node. # - # @return [NextNode] a new instance of NextNode + # @return [MultiTargetNode] a new instance of MultiTargetNode # - # source://prism//lib/prism/node.rb#14558 + # source://prism//lib/prism/node.rb#13017 sig do params( source: Prism::Source, - arguments: T.nilable(Prism::ArgumentsNode), - keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location) ).void end - def initialize(source, arguments, keyword_loc, location); end + def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#14659 + # source://prism//lib/prism/node.rb#13170 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#14567 + # source://prism//lib/prism/node.rb#13030 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader arguments: ArgumentsNode? - # - # source://prism//lib/prism/node.rb#14602 - sig { returns(T.nilable(Prism::ArgumentsNode)) } - def arguments; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14572 + # source://prism//lib/prism/node.rb#13035 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#14584 + # source://prism//lib/prism/node.rb#13049 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#14577 + # source://prism//lib/prism/node.rb#13040 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?arguments: ArgumentsNode?, ?keyword_loc: Location, ?location: Location) -> NextNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], ?rest: ImplicitRestNode | SplatNode | nil, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode # - # source://prism//lib/prism/node.rb#14589 + # source://prism//lib/prism/node.rb#13054 sig do params( - arguments: T.nilable(Prism::ArgumentsNode), - keyword_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::NextNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location) + ).returns(Prism::MultiTargetNode) end - def copy(arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14572 + # source://prism//lib/prism/node.rb#13035 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { arguments: ArgumentsNode?, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], rest: ImplicitRestNode | SplatNode | nil, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], lparen_loc: Location?, rparen_loc: Location? } # - # source://prism//lib/prism/node.rb#14597 + # source://prism//lib/prism/node.rb#13062 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#14617 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def keyword: () -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#14612 - sig { returns(String) } - def keyword; end + # source://prism//lib/prism/node.rb#13154 + sig { override.returns(String) } + def inspect; end - # attr_reader keyword_loc: Location + # Represents the targets expressions before a splat node. # - # source://prism//lib/prism/node.rb#14605 - sig { returns(Prism::Location) } - def keyword_loc; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # a, (b, c, *) = 1, 2, 3, 4, 5 + # ^^^^ # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # The splat node can be absent, in that case all target expressions are in the left field. # - # def type: () -> Symbol + # a, (b, c) = 1, 2, 3, 4, 5 + # ^^^^ # - # source://prism//lib/prism/node.rb#14643 - sig { override.returns(Symbol) } - def type; end - - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14653 - def type; end + # source://prism//lib/prism/node.rb#13075 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) end -end + def lefts; end -# Represents the use of the `nil` keyword. -# -# nil -# ^^^ -# -# source://prism//lib/prism/node.rb#14670 -class Prism::NilNode < ::Prism::Node - # def initialize: (Location location) -> void - # - # @return [NilNode] a new instance of NilNode + # def lparen: () -> String? # - # source://prism//lib/prism/node.rb#14672 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#13144 + sig { returns(T.nilable(String)) } + def lparen; end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # The location of the opening parenthesis. # - # source://prism//lib/prism/node.rb#14747 - def ===(other); end - - # def accept: (Visitor visitor) -> void + # a, (b, c) = 1, 2, 3 + # ^ # - # source://prism//lib/prism/node.rb#14679 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/node.rb#13103 + sig { returns(T.nilable(Prism::Location)) } + def lparen_loc; end - # def child_nodes: () -> Array[nil | Node] + # Represents a splat node in the target expression. # - # source://prism//lib/prism/node.rb#14684 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end - - # def comment_targets: () -> Array[Node | Location] + # a, (b, *c) = 1, 2, 3, 4 + # ^^ # - # source://prism//lib/prism/node.rb#14694 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end - - # def compact_child_nodes: () -> Array[Node] + # The variable can be empty, this results in a `SplatNode` with a `nil` expression field. # - # source://prism//lib/prism/node.rb#14689 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end - - # def copy: (?location: Location) -> NilNode + # a, (b, *) = 1, 2, 3, 4 + # ^ # - # source://prism//lib/prism/node.rb#14699 - sig { params(location: Prism::Location).returns(Prism::NilNode) } - def copy(location: T.unsafe(nil)); end - - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # If the `*` is omitted, this field will contain an `ImplicitRestNode` # - # source://prism//lib/prism/node.rb#14684 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # a, (b,) = 1, 2, 3, 4 + # ^ + # + # source://prism//lib/prism/node.rb#13091 + sig { returns(T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode))) } + def rest; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # Represents the targets expressions after a splat node. # - # source://prism//lib/prism/node.rb#14707 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # a, (*, b, c) = 1, 2, 3, 4, 5 + # ^^^^ + # + # source://prism//lib/prism/node.rb#13097 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end + def rights; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # def rparen: () -> String? + # + # source://prism//lib/prism/node.rb#13149 + sig { returns(T.nilable(String)) } + def rparen; end - # def inspect(NodeInspector inspector) -> String + # The location of the closing parenthesis. + # + # a, (b, c) = 1, 2, 3 + # ^ # - # source://prism//lib/prism/node.rb#14712 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#13125 + sig { returns(T.nilable(Prism::Location)) } + def rparen_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#13117 + def save_lparen_loc(repository); end + + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#13139 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#14731 + # source://prism//lib/prism/node.rb#13159 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14741 + # source://prism//lib/prism/node.rb#13164 def type; end end end -# Represents the use of `**nil` inside method arguments. +# Represents a write to a multi-target expression. # -# def a(**nil) -# ^^^^^ -# end +# a, b, c = 1, 2, 3 +# ^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#14757 -class Prism::NoKeywordsParameterNode < ::Prism::Node - # def initialize: (Location operator_loc, Location keyword_loc, Location location) -> void +# source://prism//lib/prism/node.rb#13186 +class Prism::MultiWriteNode < ::Prism::Node + # Initialize a new MultiWriteNode node. # - # @return [NoKeywordsParameterNode] a new instance of NoKeywordsParameterNode + # @return [MultiWriteNode] a new instance of MultiWriteNode # - # source://prism//lib/prism/node.rb#14759 + # source://prism//lib/prism/node.rb#13188 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), operator_loc: Prism::Location, - keyword_loc: Prism::Location, - location: Prism::Location + value: Prism::Node ).void end - def initialize(source, operator_loc, keyword_loc, location); end + def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#14862 + # source://prism//lib/prism/node.rb#13371 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#14768 + # source://prism//lib/prism/node.rb#13203 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14773 + # source://prism//lib/prism/node.rb#13208 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#14783 + # source://prism//lib/prism/node.rb#13223 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#14778 + # source://prism//lib/prism/node.rb#13213 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?operator_loc: Location, ?keyword_loc: Location, ?location: Location) -> NoKeywordsParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], ?rest: ImplicitRestNode | SplatNode | nil, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode # - # source://prism//lib/prism/node.rb#14788 + # source://prism//lib/prism/node.rb#13228 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), operator_loc: Prism::Location, - keyword_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::NoKeywordsParameterNode) + value: Prism::Node + ).returns(Prism::MultiWriteNode) end - def copy(operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#14773 + # source://prism//lib/prism/node.rb#13208 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { operator_loc: Location, keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], rest: ImplicitRestNode | SplatNode | nil, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/node.rb#14796 + # source://prism//lib/prism/node.rb#13236 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#14825 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#13355 + sig { override.returns(String) } + def inspect; end - # def keyword: () -> String + # Represents the targets expressions before a splat node. # - # source://prism//lib/prism/node.rb#14820 - sig { returns(String) } - def keyword; end + # a, b, * = 1, 2, 3, 4, 5 + # ^^^^ + # + # The splat node can be absent, in that case all target expressions are in the left field. + # + # a, b, c = 1, 2, 3, 4, 5 + # ^^^^^^^ + # + # source://prism//lib/prism/node.rb#13249 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end + def lefts; end - # attr_reader keyword_loc: Location + # def lparen: () -> String? # - # source://prism//lib/prism/node.rb#14808 - sig { returns(Prism::Location) } - def keyword_loc; end + # source://prism//lib/prism/node.rb#13340 + sig { returns(T.nilable(String)) } + def lparen; end + + # The location of the opening parenthesis. + # + # (a, b, c) = 1, 2, 3 + # ^ + # + # source://prism//lib/prism/node.rb#13277 + sig { returns(T.nilable(Prism::Location)) } + def lparen_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#14815 + # source://prism//lib/prism/node.rb#13350 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # The location of the operator. + # + # a, b, c = 1, 2, 3 + # ^ # - # source://prism//lib/prism/node.rb#14801 + # source://prism//lib/prism/node.rb#13321 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Represents a splat node in the target expression. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # a, b, *c = 1, 2, 3, 4 + # ^^ # - # def type: () -> Symbol + # The variable can be empty, this results in a `SplatNode` with a `nil` expression field. # - # source://prism//lib/prism/node.rb#14846 - sig { override.returns(Symbol) } - def type; end + # a, b, * = 1, 2, 3, 4 + # ^ + # + # If the `*` is omitted, this field will contain an `ImplicitRestNode` + # + # a, b, = 1, 2, 3, 4 + # ^ + # + # source://prism//lib/prism/node.rb#13265 + sig { returns(T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode))) } + def rest; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14856 - def type; end + # Represents the targets expressions after a splat node. + # + # a, *, b, c = 1, 2, 3, 4, 5 + # ^^^^ + # + # source://prism//lib/prism/node.rb#13271 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) end -end + def rights; end -# This represents a node in the tree. It is the parent class of all of the -# various node types. -# -# source://prism//lib/prism/node.rb#12 -class Prism::Node - abstract! + # def rparen: () -> String? + # + # source://prism//lib/prism/node.rb#13345 + sig { returns(T.nilable(String)) } + def rparen; end - # Accepts a visitor and calls back into the specialized visit function. + # The location of the closing parenthesis. # - # @raise [NoMethodError] + # (a, b, c) = 1, 2, 3 + # ^ # - # source://prism//lib/prism/node.rb#90 - sig { abstract.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/node.rb#13299 + sig { returns(T.nilable(Prism::Location)) } + def rparen_loc; end - # Returns an array of child nodes, including `nil`s in the place of optional - # nodes that were not present. + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. # - # @raise [NoMethodError] + # source://prism//lib/prism/node.rb#13291 + def save_lparen_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#96 - sig { abstract.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/node.rb#13329 + def save_operator_loc(repository); end - # Returns an array of child nodes and locations that could potentially have - # comments attached to them. + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # @raise [NoMethodError] + # source://prism//lib/prism/node.rb#13313 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#110 - sig { abstract.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/node.rb#13360 + sig { override.returns(Symbol) } + def type; end - # Returns an array of child nodes, excluding any `nil`s in the place of - # optional nodes that were not present. + # The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # @raise [NoMethodError] + # a, b, c = 1, 2, 3 + # ^^^^^^^ # - # source://prism//lib/prism/node.rb#104 - sig { abstract.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/node.rb#13337 + sig { returns(Prism::Node) } + def value; end - # Returns an array of child nodes, including `nil`s in the place of optional - # nodes that were not present. + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#13365 + def type; end + end +end + +# This visitor walks through the tree and copies each node as it is being +# visited. This is useful for consumers that want to mutate the tree, as you +# can change subtrees in place without effecting the rest of the tree. +# +# source://prism//lib/prism/mutation_compiler.rb#13 +class Prism::MutationCompiler < ::Prism::Compiler + # Copy a AliasGlobalVariableNode node # - # @raise [NoMethodError] + # source://prism//lib/prism/mutation_compiler.rb#15 + def visit_alias_global_variable_node(node); end + + # Copy a AliasMethodNode node # - # source://prism//lib/prism/node.rb#96 - sig { abstract.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/mutation_compiler.rb#20 + def visit_alias_method_node(node); end - # The end offset of the node in the source. This method is effectively a - # delegate method to the location object. + # Copy a AlternationPatternNode node # - # source://prism//lib/prism/node.rb#34 - sig { returns(Integer) } - def end_offset; end + # source://prism//lib/prism/mutation_compiler.rb#25 + def visit_alternation_pattern_node(node); end - sig { abstract.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Copy a AndNode node + # + # source://prism//lib/prism/mutation_compiler.rb#30 + def visit_and_node(node); end - # Returns a string representation of the node. + # Copy a ArgumentsNode node # - # @raise [NoMethodError] + # source://prism//lib/prism/mutation_compiler.rb#35 + def visit_arguments_node(node); end + + # Copy a ArrayNode node # - # source://prism//lib/prism/node.rb#121 - sig { abstract.params(inspector: Prism::NodeInspector).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#40 + def visit_array_node(node); end - # A Location instance that represents the location of this node in the - # source. + # Copy a ArrayPatternNode node # - # source://prism//lib/prism/node.rb#19 - sig { returns(Prism::Location) } - def location; end + # source://prism//lib/prism/mutation_compiler.rb#45 + def visit_array_pattern_node(node); end - # @return [Boolean] + # Copy a AssocNode node # - # source://prism//lib/prism/node.rb#39 - def newline?; end + # source://prism//lib/prism/mutation_compiler.rb#50 + def visit_assoc_node(node); end - # Similar to inspect, but respects the current level of indentation given by - # the pretty print object. + # Copy a AssocSplatNode node # - # source://prism//lib/prism/node.rb#58 - sig { params(q: T.untyped).void } - def pretty_print(q); end + # source://prism//lib/prism/mutation_compiler.rb#55 + def visit_assoc_splat_node(node); end - # source://prism//lib/prism/node.rb#43 - def set_newline_flag(newline_marked); end + # Copy a BackReferenceReadNode node + # + # source://prism//lib/prism/mutation_compiler.rb#60 + def visit_back_reference_read_node(node); end - # Slice the location of the node from the source. + # Copy a BeginNode node # - # source://prism//lib/prism/node.rb#52 - sig { returns(String) } - def slice; end + # source://prism//lib/prism/mutation_compiler.rb#65 + def visit_begin_node(node); end - # The start offset of the node in the source. This method is effectively a - # delegate method to the location object. + # Copy a BlockArgumentNode node # - # source://prism//lib/prism/node.rb#27 - sig { returns(Integer) } - def start_offset; end + # source://prism//lib/prism/mutation_compiler.rb#70 + def visit_block_argument_node(node); end - # Convert this node into a graphviz dot graph string. + # Copy a BlockLocalVariableNode node # - # source://prism//lib/prism/node.rb#66 - sig { returns(String) } - def to_dot; end + # source://prism//lib/prism/mutation_compiler.rb#75 + def visit_block_local_variable_node(node); end - # Returns a symbol symbolizing the type of node that this represents. This - # is particularly useful for case statements and array comparisons. + # Copy a BlockNode node # - # @raise [NoMethodError] + # source://prism//lib/prism/mutation_compiler.rb#80 + def visit_block_node(node); end + + # Copy a BlockParameterNode node # - # source://prism//lib/prism/node.rb#116 - sig { abstract.returns(Symbol) } - def type; end + # source://prism//lib/prism/mutation_compiler.rb#85 + def visit_block_parameter_node(node); end - private + # Copy a BlockParametersNode node + # + # source://prism//lib/prism/mutation_compiler.rb#90 + def visit_block_parameters_node(node); end - # A pointer to the source that this node was created from. + # Copy a BreakNode node # - # source://prism//lib/prism/node.rb#14 - sig { returns(Prism::Source) } - def source; end + # source://prism//lib/prism/mutation_compiler.rb#95 + def visit_break_node(node); end - class << self - # Returns a list of the fields that exist for this node class. Fields - # describe the structure of the node. This kind of reflection is useful for - # things like recursively visiting each node _and_ field in the tree. - # - # @raise [NoMethodError] - # - # source://prism//lib/prism/node.rb#74 - def fields; end + # Copy a CallAndWriteNode node + # + # source://prism//lib/prism/mutation_compiler.rb#100 + def visit_call_and_write_node(node); end - # Returns the type of the node as a symbol. - # - # @raise [NoMethodError] - # - # source://prism//lib/prism/node.rb#126 - def type; end - end -end + # Copy a CallNode node + # + # source://prism//lib/prism/mutation_compiler.rb#105 + def visit_call_node(node); end -# This object is responsible for generating the output for the inspect method -# implementations of child nodes. -# -# source://prism//lib/prism/node_inspector.rb#6 -class Prism::NodeInspector - # @return [NodeInspector] a new instance of NodeInspector + # Copy a CallOperatorWriteNode node # - # source://prism//lib/prism/node_inspector.rb#9 - def initialize(prefix = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#110 + def visit_call_operator_write_node(node); end - # Appends a line to the output with the current prefix. + # Copy a CallOrWriteNode node # - # source://prism//lib/prism/node_inspector.rb#15 - def <<(line); end + # source://prism//lib/prism/mutation_compiler.rb#115 + def visit_call_or_write_node(node); end - # Returns a new inspector that can be used to inspect a child node. + # Copy a CallTargetNode node # - # source://prism//lib/prism/node_inspector.rb#59 - def child_inspector(append); end + # source://prism//lib/prism/mutation_compiler.rb#120 + def visit_call_target_node(node); end - # Generates a string that represents a child node. + # Copy a CapturePatternNode node # - # source://prism//lib/prism/node_inspector.rb#54 - def child_node(node, append); end + # source://prism//lib/prism/mutation_compiler.rb#125 + def visit_capture_pattern_node(node); end - # This generates a string that is used as the header of the inspect output - # for any given node. + # Copy a CaseMatchNode node # - # source://prism//lib/prism/node_inspector.rb#21 - def header(node); end + # source://prism//lib/prism/mutation_compiler.rb#130 + def visit_case_match_node(node); end - # Generates a string that represents a list of nodes. It handles properly - # using the box drawing characters to make the output look nice. + # Copy a CaseNode node # - # source://prism//lib/prism/node_inspector.rb#31 - def list(prefix, nodes); end + # source://prism//lib/prism/mutation_compiler.rb#135 + def visit_case_node(node); end - # Generates a string that represents a location field on a node. + # Copy a ClassNode node # - # source://prism//lib/prism/node_inspector.rb#45 - def location(value); end + # source://prism//lib/prism/mutation_compiler.rb#140 + def visit_class_node(node); end - # source://prism//lib/prism/node_inspector.rb#7 - def output; end + # Copy a ClassVariableAndWriteNode node + # + # source://prism//lib/prism/mutation_compiler.rb#145 + def visit_class_variable_and_write_node(node); end - # source://prism//lib/prism/node_inspector.rb#7 - def prefix; end + # Copy a ClassVariableOperatorWriteNode node + # + # source://prism//lib/prism/mutation_compiler.rb#150 + def visit_class_variable_operator_write_node(node); end - # Returns the output as a string. + # Copy a ClassVariableOrWriteNode node # - # source://prism//lib/prism/node_inspector.rb#64 - def to_str; end -end + # source://prism//lib/prism/mutation_compiler.rb#155 + def visit_class_variable_or_write_node(node); end -# Represents an implicit set of parameters through the use of numbered parameters within a block or lambda. -# -# -> { _1 + _2 } -# ^^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#14873 -class Prism::NumberedParametersNode < ::Prism::Node - # def initialize: (Integer maximum, Location location) -> void + # Copy a ClassVariableReadNode node # - # @return [NumberedParametersNode] a new instance of NumberedParametersNode + # source://prism//lib/prism/mutation_compiler.rb#160 + def visit_class_variable_read_node(node); end + + # Copy a ClassVariableTargetNode node # - # source://prism//lib/prism/node.rb#14875 - sig { params(source: Prism::Source, maximum: Integer, location: Prism::Location).void } - def initialize(source, maximum, location); end + # source://prism//lib/prism/mutation_compiler.rb#165 + def visit_class_variable_target_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Copy a ClassVariableWriteNode node # - # source://prism//lib/prism/node.rb#14955 - def ===(other); end + # source://prism//lib/prism/mutation_compiler.rb#170 + def visit_class_variable_write_node(node); end - # def accept: (Visitor visitor) -> void + # Copy a ConstantAndWriteNode node # - # source://prism//lib/prism/node.rb#14883 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/mutation_compiler.rb#175 + def visit_constant_and_write_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Copy a ConstantOperatorWriteNode node # - # source://prism//lib/prism/node.rb#14888 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#180 + def visit_constant_operator_write_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Copy a ConstantOrWriteNode node # - # source://prism//lib/prism/node.rb#14898 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/mutation_compiler.rb#185 + def visit_constant_or_write_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Copy a ConstantPathAndWriteNode node # - # source://prism//lib/prism/node.rb#14893 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#190 + def visit_constant_path_and_write_node(node); end - # def copy: (?maximum: Integer, ?location: Location) -> NumberedParametersNode + # Copy a ConstantPathNode node # - # source://prism//lib/prism/node.rb#14903 - sig { params(maximum: Integer, location: Prism::Location).returns(Prism::NumberedParametersNode) } - def copy(maximum: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#195 + def visit_constant_path_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Copy a ConstantPathOperatorWriteNode node # - # source://prism//lib/prism/node.rb#14888 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/mutation_compiler.rb#200 + def visit_constant_path_operator_write_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { maximum: Integer, location: Location } + # Copy a ConstantPathOrWriteNode node # - # source://prism//lib/prism/node.rb#14911 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/mutation_compiler.rb#205 + def visit_constant_path_or_write_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Copy a ConstantPathTargetNode node + # + # source://prism//lib/prism/mutation_compiler.rb#210 + def visit_constant_path_target_node(node); end - # def inspect(NodeInspector inspector) -> String + # Copy a ConstantPathWriteNode node # - # source://prism//lib/prism/node.rb#14919 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#215 + def visit_constant_path_write_node(node); end - # attr_reader maximum: Integer + # Copy a ConstantReadNode node # - # source://prism//lib/prism/node.rb#14916 - sig { returns(Integer) } - def maximum; end + # source://prism//lib/prism/mutation_compiler.rb#220 + def visit_constant_read_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Copy a ConstantTargetNode node # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/mutation_compiler.rb#225 + def visit_constant_target_node(node); end + + # Copy a ConstantWriteNode node # - # def type: () -> Symbol + # source://prism//lib/prism/mutation_compiler.rb#230 + def visit_constant_write_node(node); end + + # Copy a DefNode node # - # source://prism//lib/prism/node.rb#14939 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/mutation_compiler.rb#235 + def visit_def_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#14949 - def type; end - end -end + # Copy a DefinedNode node + # + # source://prism//lib/prism/mutation_compiler.rb#240 + def visit_defined_node(node); end -# Represents reading a numbered reference to a capture in the previous match. -# -# $1 -# ^^ -# -# source://prism//lib/prism/node.rb#14965 -class Prism::NumberedReferenceReadNode < ::Prism::Node - # def initialize: (Integer number, Location location) -> void + # Copy a ElseNode node # - # @return [NumberedReferenceReadNode] a new instance of NumberedReferenceReadNode + # source://prism//lib/prism/mutation_compiler.rb#245 + def visit_else_node(node); end + + # Copy a EmbeddedStatementsNode node # - # source://prism//lib/prism/node.rb#14967 - sig { params(source: Prism::Source, number: Integer, location: Prism::Location).void } - def initialize(source, number, location); end + # source://prism//lib/prism/mutation_compiler.rb#250 + def visit_embedded_statements_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Copy a EmbeddedVariableNode node # - # source://prism//lib/prism/node.rb#15053 - def ===(other); end + # source://prism//lib/prism/mutation_compiler.rb#255 + def visit_embedded_variable_node(node); end - # def accept: (Visitor visitor) -> void + # Copy a EnsureNode node # - # source://prism//lib/prism/node.rb#14975 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/mutation_compiler.rb#260 + def visit_ensure_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Copy a FalseNode node # - # source://prism//lib/prism/node.rb#14980 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#265 + def visit_false_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Copy a FindPatternNode node # - # source://prism//lib/prism/node.rb#14990 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/mutation_compiler.rb#270 + def visit_find_pattern_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Copy a FlipFlopNode node # - # source://prism//lib/prism/node.rb#14985 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#275 + def visit_flip_flop_node(node); end - # def copy: (?number: Integer, ?location: Location) -> NumberedReferenceReadNode + # Copy a FloatNode node # - # source://prism//lib/prism/node.rb#14995 - sig { params(number: Integer, location: Prism::Location).returns(Prism::NumberedReferenceReadNode) } - def copy(number: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#280 + def visit_float_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Copy a ForNode node # - # source://prism//lib/prism/node.rb#14980 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/mutation_compiler.rb#285 + def visit_for_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { number: Integer, location: Location } + # Copy a ForwardingArgumentsNode node # - # source://prism//lib/prism/node.rb#15003 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/mutation_compiler.rb#290 + def visit_forwarding_arguments_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Copy a ForwardingParameterNode node + # + # source://prism//lib/prism/mutation_compiler.rb#295 + def visit_forwarding_parameter_node(node); end - # def inspect(NodeInspector inspector) -> String + # Copy a ForwardingSuperNode node # - # source://prism//lib/prism/node.rb#15017 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#300 + def visit_forwarding_super_node(node); end - # The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`. + # Copy a GlobalVariableAndWriteNode node # - # $1 # number `1` + # source://prism//lib/prism/mutation_compiler.rb#305 + def visit_global_variable_and_write_node(node); end + + # Copy a GlobalVariableOperatorWriteNode node # - # $5432 # number `5432` + # source://prism//lib/prism/mutation_compiler.rb#310 + def visit_global_variable_operator_write_node(node); end + + # Copy a GlobalVariableOrWriteNode node # - # $4294967296 # number `0` + # source://prism//lib/prism/mutation_compiler.rb#315 + def visit_global_variable_or_write_node(node); end + + # Copy a GlobalVariableReadNode node # - # source://prism//lib/prism/node.rb#15014 - sig { returns(Integer) } - def number; end + # source://prism//lib/prism/mutation_compiler.rb#320 + def visit_global_variable_read_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Copy a GlobalVariableTargetNode node # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/mutation_compiler.rb#325 + def visit_global_variable_target_node(node); end + + # Copy a GlobalVariableWriteNode node # - # def type: () -> Symbol + # source://prism//lib/prism/mutation_compiler.rb#330 + def visit_global_variable_write_node(node); end + + # Copy a HashNode node # - # source://prism//lib/prism/node.rb#15037 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/mutation_compiler.rb#335 + def visit_hash_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15047 - def type; end - end -end + # Copy a HashPatternNode node + # + # source://prism//lib/prism/mutation_compiler.rb#340 + def visit_hash_pattern_node(node); end -# Represents an optional keyword parameter to a method, block, or lambda definition. -# -# def a(b: 1) -# ^^^^ -# end -# -# source://prism//lib/prism/node.rb#15064 -class Prism::OptionalKeywordParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol name, Location name_loc, Prism::node value, Location location) -> void + # Copy a IfNode node # - # @return [OptionalKeywordParameterNode] a new instance of OptionalKeywordParameterNode + # source://prism//lib/prism/mutation_compiler.rb#345 + def visit_if_node(node); end + + # Copy a ImaginaryNode node # - # source://prism//lib/prism/node.rb#15066 - sig do - params( - source: Prism::Source, - flags: Integer, - name: Symbol, - name_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).void - end - def initialize(source, flags, name, name_loc, value, location); end + # source://prism//lib/prism/mutation_compiler.rb#350 + def visit_imaginary_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Copy a ImplicitNode node # - # source://prism//lib/prism/node.rb#15173 - def ===(other); end + # source://prism//lib/prism/mutation_compiler.rb#355 + def visit_implicit_node(node); end - # def accept: (Visitor visitor) -> void + # Copy a ImplicitRestNode node # - # source://prism//lib/prism/node.rb#15077 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/mutation_compiler.rb#360 + def visit_implicit_rest_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Copy a InNode node # - # source://prism//lib/prism/node.rb#15082 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#365 + def visit_in_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Copy a IndexAndWriteNode node # - # source://prism//lib/prism/node.rb#15092 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/mutation_compiler.rb#370 + def visit_index_and_write_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Copy a IndexOperatorWriteNode node # - # source://prism//lib/prism/node.rb#15087 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#375 + def visit_index_operator_write_node(node); end - # def copy: (?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?location: Location) -> OptionalKeywordParameterNode + # Copy a IndexOrWriteNode node # - # source://prism//lib/prism/node.rb#15097 - sig do - params( - flags: Integer, - name: Symbol, - name_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).returns(Prism::OptionalKeywordParameterNode) - end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#380 + def visit_index_or_write_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Copy a IndexTargetNode node # - # source://prism//lib/prism/node.rb#15082 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/mutation_compiler.rb#385 + def visit_index_target_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol, name_loc: Location, value: Prism::node, location: Location } + # Copy a InstanceVariableAndWriteNode node # - # source://prism//lib/prism/node.rb#15105 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/mutation_compiler.rb#390 + def visit_instance_variable_and_write_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Copy a InstanceVariableOperatorWriteNode node + # + # source://prism//lib/prism/mutation_compiler.rb#395 + def visit_instance_variable_operator_write_node(node); end - # def inspect(NodeInspector inspector) -> String + # Copy a InstanceVariableOrWriteNode node # - # source://prism//lib/prism/node.rb#15132 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#400 + def visit_instance_variable_or_write_node(node); end - # attr_reader name: Symbol + # Copy a InstanceVariableReadNode node # - # source://prism//lib/prism/node.rb#15114 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/mutation_compiler.rb#405 + def visit_instance_variable_read_node(node); end - # attr_reader name_loc: Location + # Copy a InstanceVariableTargetNode node # - # source://prism//lib/prism/node.rb#15117 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/mutation_compiler.rb#410 + def visit_instance_variable_target_node(node); end - # def repeated_parameter?: () -> bool + # Copy a InstanceVariableWriteNode node # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#15127 - sig { returns(T::Boolean) } - def repeated_parameter?; end + # source://prism//lib/prism/mutation_compiler.rb#415 + def visit_instance_variable_write_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Copy a IntegerNode node # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/mutation_compiler.rb#420 + def visit_integer_node(node); end + + # Copy a InterpolatedMatchLastLineNode node # - # def type: () -> Symbol + # source://prism//lib/prism/mutation_compiler.rb#425 + def visit_interpolated_match_last_line_node(node); end + + # Copy a InterpolatedRegularExpressionNode node # - # source://prism//lib/prism/node.rb#15157 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/mutation_compiler.rb#430 + def visit_interpolated_regular_expression_node(node); end - # attr_reader value: Prism::node + # Copy a InterpolatedStringNode node # - # source://prism//lib/prism/node.rb#15124 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/mutation_compiler.rb#435 + def visit_interpolated_string_node(node); end - protected + # Copy a InterpolatedSymbolNode node + # + # source://prism//lib/prism/mutation_compiler.rb#440 + def visit_interpolated_symbol_node(node); end - # protected attr_reader flags: Integer + # Copy a InterpolatedXStringNode node # - # source://prism//lib/prism/node.rb#15110 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/mutation_compiler.rb#445 + def visit_interpolated_x_string_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15167 - def type; end - end -end + # Copy a ItLocalVariableReadNode node + # + # source://prism//lib/prism/mutation_compiler.rb#450 + def visit_it_local_variable_read_node(node); end -# Represents an optional parameter to a method, block, or lambda definition. -# -# def a(b = 1) -# ^^^^^ -# end -# -# source://prism//lib/prism/node.rb#15187 -class Prism::OptionalParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value, Location location) -> void + # Copy a ItParametersNode node # - # @return [OptionalParameterNode] a new instance of OptionalParameterNode + # source://prism//lib/prism/mutation_compiler.rb#455 + def visit_it_parameters_node(node); end + + # Copy a KeywordHashNode node # - # source://prism//lib/prism/node.rb#15189 - sig do - params( - source: Prism::Source, - flags: Integer, - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).void - end - def initialize(source, flags, name, name_loc, operator_loc, value, location); end + # source://prism//lib/prism/mutation_compiler.rb#460 + def visit_keyword_hash_node(node); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Copy a KeywordRestParameterNode node # - # source://prism//lib/prism/node.rb#15310 - def ===(other); end + # source://prism//lib/prism/mutation_compiler.rb#465 + def visit_keyword_rest_parameter_node(node); end - # def accept: (Visitor visitor) -> void + # Copy a LambdaNode node # - # source://prism//lib/prism/node.rb#15201 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/mutation_compiler.rb#470 + def visit_lambda_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Copy a LocalVariableAndWriteNode node # - # source://prism//lib/prism/node.rb#15206 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#475 + def visit_local_variable_and_write_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Copy a LocalVariableOperatorWriteNode node # - # source://prism//lib/prism/node.rb#15216 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/mutation_compiler.rb#480 + def visit_local_variable_operator_write_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Copy a LocalVariableOrWriteNode node # - # source://prism//lib/prism/node.rb#15211 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/mutation_compiler.rb#485 + def visit_local_variable_or_write_node(node); end - # def copy: (?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?location: Location) -> OptionalParameterNode + # Copy a LocalVariableReadNode node # - # source://prism//lib/prism/node.rb#15221 - sig do - params( - flags: Integer, - name: Symbol, - name_loc: Prism::Location, - operator_loc: Prism::Location, - value: Prism::Node, - location: Prism::Location - ).returns(Prism::OptionalParameterNode) - end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#490 + def visit_local_variable_read_node(node); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Copy a LocalVariableTargetNode node # - # source://prism//lib/prism/node.rb#15206 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/mutation_compiler.rb#495 + def visit_local_variable_target_node(node); end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node, location: Location } + # Copy a LocalVariableWriteNode node # - # source://prism//lib/prism/node.rb#15229 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/mutation_compiler.rb#500 + def visit_local_variable_write_node(node); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Copy a MatchLastLineNode node + # + # source://prism//lib/prism/mutation_compiler.rb#505 + def visit_match_last_line_node(node); end - # def inspect(NodeInspector inspector) -> String + # Copy a MatchPredicateNode node # - # source://prism//lib/prism/node.rb#15268 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/mutation_compiler.rb#510 + def visit_match_predicate_node(node); end - # attr_reader name: Symbol + # Copy a MatchRequiredNode node # - # source://prism//lib/prism/node.rb#15238 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/mutation_compiler.rb#515 + def visit_match_required_node(node); end - # attr_reader name_loc: Location + # Copy a MatchWriteNode node # - # source://prism//lib/prism/node.rb#15241 - sig { returns(Prism::Location) } - def name_loc; end + # source://prism//lib/prism/mutation_compiler.rb#520 + def visit_match_write_node(node); end - # def operator: () -> String + # Copy a MissingNode node # - # source://prism//lib/prism/node.rb#15263 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/mutation_compiler.rb#525 + def visit_missing_node(node); end - # attr_reader operator_loc: Location + # Copy a ModuleNode node # - # source://prism//lib/prism/node.rb#15248 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/mutation_compiler.rb#530 + def visit_module_node(node); end - # def repeated_parameter?: () -> bool + # Copy a MultiTargetNode node # - # @return [Boolean] + # source://prism//lib/prism/mutation_compiler.rb#535 + def visit_multi_target_node(node); end + + # Copy a MultiWriteNode node # - # source://prism//lib/prism/node.rb#15258 - sig { returns(T::Boolean) } - def repeated_parameter?; end + # source://prism//lib/prism/mutation_compiler.rb#540 + def visit_multi_write_node(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Copy a NextNode node # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/mutation_compiler.rb#545 + def visit_next_node(node); end + + # Copy a NilNode node # - # def type: () -> Symbol + # source://prism//lib/prism/mutation_compiler.rb#550 + def visit_nil_node(node); end + + # Copy a NoKeywordsParameterNode node # - # source://prism//lib/prism/node.rb#15294 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/mutation_compiler.rb#555 + def visit_no_keywords_parameter_node(node); end - # attr_reader value: Prism::node + # Copy a NumberedParametersNode node # - # source://prism//lib/prism/node.rb#15255 - sig { returns(Prism::Node) } - def value; end + # source://prism//lib/prism/mutation_compiler.rb#560 + def visit_numbered_parameters_node(node); end - protected + # Copy a NumberedReferenceReadNode node + # + # source://prism//lib/prism/mutation_compiler.rb#565 + def visit_numbered_reference_read_node(node); end - # protected attr_reader flags: Integer + # Copy a OptionalKeywordParameterNode node # - # source://prism//lib/prism/node.rb#15234 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/mutation_compiler.rb#570 + def visit_optional_keyword_parameter_node(node); end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15304 - def type; end - end -end + # Copy a OptionalParameterNode node + # + # source://prism//lib/prism/mutation_compiler.rb#575 + def visit_optional_parameter_node(node); end -# Represents the use of the `||` operator or the `or` keyword. -# -# left or right -# ^^^^^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#15324 -class Prism::OrNode < ::Prism::Node - # def initialize: (Prism::node left, Prism::node right, Location operator_loc, Location location) -> void + # Copy a OrNode node # - # @return [OrNode] a new instance of OrNode + # source://prism//lib/prism/mutation_compiler.rb#580 + def visit_or_node(node); end + + # Copy a ParametersNode node # - # source://prism//lib/prism/node.rb#15326 + # source://prism//lib/prism/mutation_compiler.rb#585 + def visit_parameters_node(node); end + + # Copy a ParenthesesNode node + # + # source://prism//lib/prism/mutation_compiler.rb#590 + def visit_parentheses_node(node); end + + # Copy a PinnedExpressionNode node + # + # source://prism//lib/prism/mutation_compiler.rb#595 + def visit_pinned_expression_node(node); end + + # Copy a PinnedVariableNode node + # + # source://prism//lib/prism/mutation_compiler.rb#600 + def visit_pinned_variable_node(node); end + + # Copy a PostExecutionNode node + # + # source://prism//lib/prism/mutation_compiler.rb#605 + def visit_post_execution_node(node); end + + # Copy a PreExecutionNode node + # + # source://prism//lib/prism/mutation_compiler.rb#610 + def visit_pre_execution_node(node); end + + # Copy a ProgramNode node + # + # source://prism//lib/prism/mutation_compiler.rb#615 + def visit_program_node(node); end + + # Copy a RangeNode node + # + # source://prism//lib/prism/mutation_compiler.rb#620 + def visit_range_node(node); end + + # Copy a RationalNode node + # + # source://prism//lib/prism/mutation_compiler.rb#625 + def visit_rational_node(node); end + + # Copy a RedoNode node + # + # source://prism//lib/prism/mutation_compiler.rb#630 + def visit_redo_node(node); end + + # Copy a RegularExpressionNode node + # + # source://prism//lib/prism/mutation_compiler.rb#635 + def visit_regular_expression_node(node); end + + # Copy a RequiredKeywordParameterNode node + # + # source://prism//lib/prism/mutation_compiler.rb#640 + def visit_required_keyword_parameter_node(node); end + + # Copy a RequiredParameterNode node + # + # source://prism//lib/prism/mutation_compiler.rb#645 + def visit_required_parameter_node(node); end + + # Copy a RescueModifierNode node + # + # source://prism//lib/prism/mutation_compiler.rb#650 + def visit_rescue_modifier_node(node); end + + # Copy a RescueNode node + # + # source://prism//lib/prism/mutation_compiler.rb#655 + def visit_rescue_node(node); end + + # Copy a RestParameterNode node + # + # source://prism//lib/prism/mutation_compiler.rb#660 + def visit_rest_parameter_node(node); end + + # Copy a RetryNode node + # + # source://prism//lib/prism/mutation_compiler.rb#665 + def visit_retry_node(node); end + + # Copy a ReturnNode node + # + # source://prism//lib/prism/mutation_compiler.rb#670 + def visit_return_node(node); end + + # Copy a SelfNode node + # + # source://prism//lib/prism/mutation_compiler.rb#675 + def visit_self_node(node); end + + # Copy a ShareableConstantNode node + # + # source://prism//lib/prism/mutation_compiler.rb#680 + def visit_shareable_constant_node(node); end + + # Copy a SingletonClassNode node + # + # source://prism//lib/prism/mutation_compiler.rb#685 + def visit_singleton_class_node(node); end + + # Copy a SourceEncodingNode node + # + # source://prism//lib/prism/mutation_compiler.rb#690 + def visit_source_encoding_node(node); end + + # Copy a SourceFileNode node + # + # source://prism//lib/prism/mutation_compiler.rb#695 + def visit_source_file_node(node); end + + # Copy a SourceLineNode node + # + # source://prism//lib/prism/mutation_compiler.rb#700 + def visit_source_line_node(node); end + + # Copy a SplatNode node + # + # source://prism//lib/prism/mutation_compiler.rb#705 + def visit_splat_node(node); end + + # Copy a StatementsNode node + # + # source://prism//lib/prism/mutation_compiler.rb#710 + def visit_statements_node(node); end + + # Copy a StringNode node + # + # source://prism//lib/prism/mutation_compiler.rb#715 + def visit_string_node(node); end + + # Copy a SuperNode node + # + # source://prism//lib/prism/mutation_compiler.rb#720 + def visit_super_node(node); end + + # Copy a SymbolNode node + # + # source://prism//lib/prism/mutation_compiler.rb#725 + def visit_symbol_node(node); end + + # Copy a TrueNode node + # + # source://prism//lib/prism/mutation_compiler.rb#730 + def visit_true_node(node); end + + # Copy a UndefNode node + # + # source://prism//lib/prism/mutation_compiler.rb#735 + def visit_undef_node(node); end + + # Copy a UnlessNode node + # + # source://prism//lib/prism/mutation_compiler.rb#740 + def visit_unless_node(node); end + + # Copy a UntilNode node + # + # source://prism//lib/prism/mutation_compiler.rb#745 + def visit_until_node(node); end + + # Copy a WhenNode node + # + # source://prism//lib/prism/mutation_compiler.rb#750 + def visit_when_node(node); end + + # Copy a WhileNode node + # + # source://prism//lib/prism/mutation_compiler.rb#755 + def visit_while_node(node); end + + # Copy a XStringNode node + # + # source://prism//lib/prism/mutation_compiler.rb#760 + def visit_x_string_node(node); end + + # Copy a YieldNode node + # + # source://prism//lib/prism/mutation_compiler.rb#765 + def visit_yield_node(node); end +end + +# Represents the use of the `next` keyword. +# +# next 1 +# ^^^^^^ +# +# source://prism//lib/prism/node.rb#13389 +class Prism::NextNode < ::Prism::Node + # Initialize a new NextNode node. + # + # @return [NextNode] a new instance of NextNode + # + # source://prism//lib/prism/node.rb#13391 sig do params( source: Prism::Source, - left: Prism::Node, - right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location ).void end - def initialize(source, left, right, operator_loc, location); end + def initialize(source, node_id, location, flags, arguments, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#15442 + # source://prism//lib/prism/node.rb#13473 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#15336 + # source://prism//lib/prism/node.rb#13401 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader arguments: ArgumentsNode? + # + # source://prism//lib/prism/node.rb#13436 + sig { returns(T.nilable(Prism::ArgumentsNode)) } + def arguments; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15341 + # source://prism//lib/prism/node.rb#13406 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#15351 + # source://prism//lib/prism/node.rb#13418 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#15346 + # source://prism//lib/prism/node.rb#13411 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?left: Prism::node, ?right: Prism::node, ?operator_loc: Location, ?location: Location) -> OrNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode # - # source://prism//lib/prism/node.rb#15356 + # source://prism//lib/prism/node.rb#13423 sig do params( - left: Prism::Node, - right: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::OrNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).returns(Prism::NextNode) end - def copy(left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15341 + # source://prism//lib/prism/node.rb#13406 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { left: Prism::node, right: Prism::node, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, arguments: ArgumentsNode?, keyword_loc: Location } # - # source://prism//lib/prism/node.rb#15364 + # source://prism//lib/prism/node.rb#13431 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#15402 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). - # - # left or right - # ^^^^ - # - # 1 || 2 - # ^ + # def inspect -> String # - # source://prism//lib/prism/node.rb#15375 - sig { returns(Prism::Node) } - def left; end + # source://prism//lib/prism/node.rb#13457 + sig { override.returns(String) } + def inspect; end - # def operator: () -> String + # def keyword: () -> String # - # source://prism//lib/prism/node.rb#15397 + # source://prism//lib/prism/node.rb#13452 sig { returns(String) } - def operator; end + def keyword; end - # The location of the `or` keyword or the `||` operator. - # - # left or right - # ^^ + # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#15390 + # source://prism//lib/prism/node.rb#13439 sig { returns(Prism::Location) } - def operator_loc; end + def keyword_loc; end - # Represents the right side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # left || right - # ^^^^^ - # - # 1 or 2 - # ^ - # - # source://prism//lib/prism/node.rb#15384 - sig { returns(Prism::Node) } - def right; end + # source://prism//lib/prism/node.rb#13447 + def save_keyword_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15426 + # source://prism//lib/prism/node.rb#13462 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#15436 + # source://prism//lib/prism/node.rb#13467 def type; end end end -# A parser for the pack template language. +# Represents the use of the `nil` keyword. # -# source://prism//lib/prism/pack.rb#6 -module Prism::Pack - class << self - def parse(_arg0, _arg1, _arg2); end - end -end - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::AGNOSTIC_ENDIAN = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::BACK = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::BER = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::BIG_ENDIAN = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::COMMENT = T.let(T.unsafe(nil), Symbol) - -# A directive in the pack template language. +# nil +# ^^^ # -# source://prism//lib/prism/pack.rb#60 -class Prism::Pack::Directive - # Initialize a new directive with the given values. +# source://prism//lib/prism/node.rb#13484 +class Prism::NilNode < ::Prism::Node + # Initialize a new NilNode node. # - # @return [Directive] a new instance of Directive + # @return [NilNode] a new instance of NilNode # - # source://prism//lib/prism/pack.rb#89 - def initialize(version, variant, source, type, signed, endian, size, length_type, length); end + # source://prism//lib/prism/node.rb#13486 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end - # Provide a human-readable description of the directive. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/pack.rb#131 - def describe; end + # source://prism//lib/prism/node.rb#13543 + def ===(other); end - # The type of endianness of the directive. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/pack.rb#77 - def endian; end + # source://prism//lib/prism/node.rb#13494 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # The length of this directive (used for integers). + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/pack.rb#86 - def length; end + # source://prism//lib/prism/node.rb#13499 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # The length type of this directive (used for integers). + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/pack.rb#83 - def length_type; end + # source://prism//lib/prism/node.rb#13509 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # The type of signedness of the directive. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/pack.rb#74 - def signed; end + # source://prism//lib/prism/node.rb#13504 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # The size of the directive. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> NilNode # - # source://prism//lib/prism/pack.rb#80 - def size; end + # source://prism//lib/prism/node.rb#13514 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::NilNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # A byteslice of the source string that this directive represents. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/pack.rb#68 - def source; end + # source://prism//lib/prism/node.rb#13499 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # The type of the directive. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/pack.rb#71 - def type; end + # source://prism//lib/prism/node.rb#13522 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # A symbol representing whether or not we are packing or unpacking. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/pack.rb#65 - def variant; end + # source://prism//lib/prism/node.rb#13527 + sig { override.returns(String) } + def inspect; end - # A symbol representing the version of Ruby. + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/pack.rb#62 - def version; end -end + # source://prism//lib/prism/node.rb#13532 + sig { override.returns(Symbol) } + def type; end -# The descriptions of the various types of endianness. -# -# source://prism//lib/prism/pack.rb#102 -Prism::Pack::Directive::ENDIAN_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#13537 + def type; end + end +end -# The descriptions of the various types of signedness. +# Represents the use of `**nil` inside method arguments. # -# source://prism//lib/prism/pack.rb#111 -Prism::Pack::Directive::SIGNED_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) - -# The descriptions of the various types of sizes. +# def a(**nil) +# ^^^^^ +# end # -# source://prism//lib/prism/pack.rb#118 -Prism::Pack::Directive::SIZE_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) +# source://prism//lib/prism/node.rb#13553 +class Prism::NoKeywordsParameterNode < ::Prism::Node + # Initialize a new NoKeywordsParameterNode node. + # + # @return [NoKeywordsParameterNode] a new instance of NoKeywordsParameterNode + # + # source://prism//lib/prism/node.rb#13555 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + keyword_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, operator_loc, keyword_loc); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::ENDIAN_NA = T.let(T.unsafe(nil), Symbol) + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. + # + # source://prism//lib/prism/node.rb#13650 + def ===(other); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::FLOAT = T.let(T.unsafe(nil), Symbol) + # def accept: (Visitor visitor) -> void + # + # source://prism//lib/prism/node.rb#13565 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end -# The result of parsing a pack template. -# -# source://prism//lib/prism/pack.rb#198 -class Prism::Pack::Format - # Create a new Format with the given directives and encoding. + # def child_nodes: () -> Array[nil | Node] # - # @return [Format] a new instance of Format + # source://prism//lib/prism/node.rb#13570 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end + + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/pack.rb#206 - def initialize(directives, encoding); end + # source://prism//lib/prism/node.rb#13580 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Provide a human-readable description of the format. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/pack.rb#212 - def describe; end + # source://prism//lib/prism/node.rb#13575 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # A list of the directives in the template. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode # - # source://prism//lib/prism/pack.rb#200 - def directives; end + # source://prism//lib/prism/node.rb#13585 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + keyword_loc: Prism::Location + ).returns(Prism::NoKeywordsParameterNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end - # The encoding of the template. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/pack.rb#203 - def encoding; end -end + # source://prism//lib/prism/node.rb#13570 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::INTEGER = T.let(T.unsafe(nil), Symbol) + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, keyword_loc: Location } + # + # source://prism//lib/prism/node.rb#13593 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::LENGTH_FIXED = T.let(T.unsafe(nil), Symbol) + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::LENGTH_MAX = T.let(T.unsafe(nil), Symbol) + # def inspect -> String + # + # source://prism//lib/prism/node.rb#13634 + sig { override.returns(String) } + def inspect; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::LENGTH_NA = T.let(T.unsafe(nil), Symbol) + # def keyword: () -> String + # + # source://prism//lib/prism/node.rb#13629 + sig { returns(String) } + def keyword; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::LENGTH_RELATIVE = T.let(T.unsafe(nil), Symbol) + # attr_reader keyword_loc: Location + # + # source://prism//lib/prism/node.rb#13611 + sig { returns(Prism::Location) } + def keyword_loc; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::LITTLE_ENDIAN = T.let(T.unsafe(nil), Symbol) + # def operator: () -> String + # + # source://prism//lib/prism/node.rb#13624 + sig { returns(String) } + def operator; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::MOVE = T.let(T.unsafe(nil), Symbol) + # attr_reader operator_loc: Location + # + # source://prism//lib/prism/node.rb#13598 + sig { returns(Prism::Location) } + def operator_loc; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::NATIVE_ENDIAN = T.let(T.unsafe(nil), Symbol) + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#13619 + def save_keyword_loc(repository); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::NULL = T.let(T.unsafe(nil), Symbol) + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#13606 + def save_operator_loc(repository); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIGNED = T.let(T.unsafe(nil), Symbol) + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#13639 + sig { override.returns(Symbol) } + def type; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIGNED_NA = T.let(T.unsafe(nil), Symbol) + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#13644 + def type; end + end +end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_16 = T.let(T.unsafe(nil), Symbol) +# This represents a node in the tree. It is the parent class of all of the +# various node types. +# +# source://prism//lib/prism/node.rb#12 +class Prism::Node + abstract! -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_32 = T.let(T.unsafe(nil), Symbol) + # Accepts a visitor and calls back into the specialized visit function. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#258 + sig { abstract.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_64 = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_8 = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_INT = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_LONG = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_LONG_LONG = T.let(T.unsafe(nil), Symbol) - -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_NA = T.let(T.unsafe(nil), Symbol) + # Returns the first node that matches the given block when visited in a + # depth-first search. This is useful for finding a node that matches a + # particular condition. + # + # node.breadth_first_search { |node| node.node_id == node_id } + # + # source://prism//lib/prism/node.rb#228 + sig { params(block: T.proc.params(node: Prism::Node).returns(T::Boolean)).returns(T.nilable(Prism::Node)) } + def breadth_first_search(&block); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_P = T.let(T.unsafe(nil), Symbol) + # Delegates to the cached_end_code_units_column of the associated location + # object. + # + # source://prism//lib/prism/node.rb#115 + def cached_end_code_units_column(cache); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SIZE_SHORT = T.let(T.unsafe(nil), Symbol) + # Delegates to the cached_end_code_units_offset of the associated location + # object. + # + # source://prism//lib/prism/node.rb#83 + def cached_end_code_units_offset(cache); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::SPACE = T.let(T.unsafe(nil), Symbol) + # Delegates to the cached_start_code_units_column of the associated location + # object. + # + # source://prism//lib/prism/node.rb#109 + def cached_start_code_units_column(cache); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_BASE64 = T.let(T.unsafe(nil), Symbol) + # Delegates to the cached_start_code_units_offset of the associated location + # object. + # + # source://prism//lib/prism/node.rb#77 + def cached_start_code_units_offset(cache); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_FIXED = T.let(T.unsafe(nil), Symbol) + # Returns an array of child nodes, including `nil`s in the place of optional + # nodes that were not present. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#264 + sig { abstract.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_HEX_HIGH = T.let(T.unsafe(nil), Symbol) + # Returns an array of child nodes and locations that could potentially have + # comments attached to them. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#278 + sig { abstract.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_HEX_LOW = T.let(T.unsafe(nil), Symbol) + # Delegates to the comments of the associated location object. + # + # source://prism//lib/prism/node.rb#130 + def comments; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_LSB = T.let(T.unsafe(nil), Symbol) + # Returns an array of child nodes, excluding any `nil`s in the place of + # optional nodes that were not present. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#272 + sig { abstract.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_MIME = T.let(T.unsafe(nil), Symbol) + # Returns an array of child nodes, including `nil`s in the place of optional + # nodes that were not present. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#264 + sig { abstract.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_MSB = T.let(T.unsafe(nil), Symbol) + # source://prism//lib/prism/node_ext.rb#7 + def deprecated(*replacements); end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_NULL_PADDED = T.let(T.unsafe(nil), Symbol) + # Delegates to the end_character_column of the associated location object. + # + # source://prism//lib/prism/node.rb#103 + def end_character_column; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_NULL_TERMINATED = T.let(T.unsafe(nil), Symbol) + # Delegates to the end_character_offset of the associated location object. + # + # source://prism//lib/prism/node.rb#71 + def end_character_offset; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_POINTER = T.let(T.unsafe(nil), Symbol) + # Delegates to the end_column of the associated location object. + # + # source://prism//lib/prism/node.rb#93 + def end_column; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_SPACE_PADDED = T.let(T.unsafe(nil), Symbol) + # Delegates to the end_line of the associated location object. + # + # source://prism//lib/prism/node.rb#47 + def end_line; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::STRING_UU = T.let(T.unsafe(nil), Symbol) + # The end offset of the node in the source. This method is effectively a + # delegate method to the location object. + # + # source://prism//lib/prism/node.rb#60 + sig { returns(Integer) } + def end_offset; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::UNSIGNED = T.let(T.unsafe(nil), Symbol) + sig { abstract.returns(T::Array[Prism::Reflection::Field]) } + def fields; end -# source://prism//lib/prism/pack.rb#56 -Prism::Pack::UTF8 = T.let(T.unsafe(nil), Symbol) + # Returns a string representation of the node. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#283 + sig { abstract.returns(String) } + def inspect; end -# Flags for parameter nodes. -# -# source://prism//lib/prism/node.rb#20409 -module Prism::ParameterFlags; end + # Delegates to the leading_comments of the associated location object. + # + # source://prism//lib/prism/node.rb#120 + def leading_comments; end -# a parameter name that has been repeated in the method signature -# -# source://prism//lib/prism/node.rb#20411 -Prism::ParameterFlags::REPEATED_PARAMETER = T.let(T.unsafe(nil), Integer) + # A Location instance that represents the location of this node in the + # source. + # + # source://prism//lib/prism/node.rb#30 + sig { returns(Prism::Location) } + def location; end -# Represents the list of parameters on a method, block, or lambda definition. -# -# def a(b, c, d) -# ^^^^^^^ -# end -# -# source://prism//lib/prism/node.rb#15455 -class Prism::ParametersNode < ::Prism::Node - # def initialize: (Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, RestParameterNode | ImplicitRestNode | nil rest, Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil keyword_rest, BlockParameterNode? block, Location location) -> void + # Returns true if the node has the newline flag set. # - # @return [ParametersNode] a new instance of ParametersNode + # @return [Boolean] # - # source://prism//lib/prism/node.rb#15457 - sig do - params( - source: Prism::Source, - requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], - optionals: T::Array[Prism::OptionalParameterNode], - rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), - posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode)], - keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], - keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), - block: T.nilable(Prism::BlockParameterNode), - location: Prism::Location - ).void - end - def initialize(source, requireds, optionals, rest, posts, keywords, keyword_rest, block, location); end + # source://prism//lib/prism/node.rb#161 + sig { returns(T::Boolean) } + def newline?; end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # source://prism//lib/prism/parse_result/newlines.rb#69 + def newline_flag!(lines); end + + # @return [Boolean] # - # source://prism//lib/prism/node.rb#15590 - def ===(other); end + # source://prism//lib/prism/parse_result/newlines.rb#65 + def newline_flag?; end - # def accept: (Visitor visitor) -> void + # A unique identifier for this node. This is used in a very specific + # use case where you want to keep around a reference to a node without + # having to keep around the syntax tree in memory. This unique identifier + # will be consistent across multiple parses of the same source code. # - # source://prism//lib/prism/node.rb#15471 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/node.rb#21 + sig { returns(Integer) } + def node_id; end - # attr_reader block: BlockParameterNode? + # Similar to inspect, but respects the current level of indentation given by + # the pretty print object. # - # source://prism//lib/prism/node.rb#15530 - sig { returns(T.nilable(Prism::BlockParameterNode)) } - def block; end + # source://prism//lib/prism/node.rb#172 + sig { params(q: T.untyped).void } + def pretty_print(q); end - # def child_nodes: () -> Array[nil | Node] + # Save this node using a saved source so that it can be retrieved later. # - # source://prism//lib/prism/node.rb#15476 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/node.rb#24 + def save(repository); end - # def comment_targets: () -> Array[Node | Location] + # Save the location using a saved source so that it can be retrieved later. # - # source://prism//lib/prism/node.rb#15494 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/node.rb#37 + def save_location(repository); end - # def compact_child_nodes: () -> Array[Node] + # Returns all of the lines of the source code associated with this node. + # An alias for source_lines, used to mimic the API from + # RubyVM::AbstractSyntaxTree to make it easier to migrate. # - # source://prism//lib/prism/node.rb#15481 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/node.rb#135 + sig { returns(T::Array[String]) } + def script_lines; end - # def copy: (?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: RestParameterNode | ImplicitRestNode | nil, ?posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, ?block: BlockParameterNode?, ?location: Location) -> ParametersNode + # Slice the location of the node from the source. # - # source://prism//lib/prism/node.rb#15499 - sig do - params( - requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], - optionals: T::Array[Prism::OptionalParameterNode], - rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), - posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode)], - keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], - keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), - block: T.nilable(Prism::BlockParameterNode), - location: Prism::Location - ).returns(Prism::ParametersNode) - end - def copy(requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#144 + sig { returns(String) } + def slice; end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Slice the location of the node from the source, starting at the beginning + # of the line that the location starts on, ending at the end of the line + # that the location ends on. # - # source://prism//lib/prism/node.rb#15476 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/node.rb#151 + sig { returns(String) } + def slice_lines; end - # def deconstruct_keys: (Array[Symbol] keys) -> { requireds: Array[RequiredParameterNode | MultiTargetNode], optionals: Array[OptionalParameterNode], rest: RestParameterNode | ImplicitRestNode | nil, posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode], keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, block: BlockParameterNode?, location: Location } + # Returns all of the lines of the source code associated with this node. # - # source://prism//lib/prism/node.rb#15507 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#135 + sig { returns(T::Array[String]) } + def source_lines; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Delegates to the start_character_column of the associated location object. + # + # source://prism//lib/prism/node.rb#98 + def start_character_column; end - # def inspect(NodeInspector inspector) -> String + # Delegates to the start_character_offset of the associated location object. # - # source://prism//lib/prism/node.rb#15533 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#66 + def start_character_offset; end - # attr_reader keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil + # Delegates to the start_column of the associated location object. # - # source://prism//lib/prism/node.rb#15527 - sig do - returns(T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode))) - end - def keyword_rest; end + # source://prism//lib/prism/node.rb#88 + def start_column; end - # attr_reader keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] + # Delegates to the start_line of the associated location object. # - # source://prism//lib/prism/node.rb#15524 - sig { returns(T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)]) } - def keywords; end + # source://prism//lib/prism/node.rb#42 + def start_line; end - # attr_reader optionals: Array[OptionalParameterNode] + # The start offset of the node in the source. This method is effectively a + # delegate method to the location object. # - # source://prism//lib/prism/node.rb#15515 - sig { returns(T::Array[Prism::OptionalParameterNode]) } - def optionals; end + # source://prism//lib/prism/node.rb#53 + sig { returns(Integer) } + def start_offset; end - # attr_reader posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode] + # Returns true if the node has the static literal flag set. # - # source://prism//lib/prism/node.rb#15521 - sig do - returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode)]) - end - def posts; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#166 + sig { returns(T::Boolean) } + def static_literal?; end - # attr_reader requireds: Array[RequiredParameterNode | MultiTargetNode] + # Convert this node into a graphviz dot graph string. # - # source://prism//lib/prism/node.rb#15512 - sig { returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)]) } - def requireds; end + # source://prism//lib/prism/node.rb#180 + sig { returns(String) } + def to_dot; end - # attr_reader rest: RestParameterNode | ImplicitRestNode | nil + # Delegates to the trailing_comments of the associated location object. # - # source://prism//lib/prism/node.rb#15518 - sig { returns(T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode))) } - def rest; end + # source://prism//lib/prism/node.rb#125 + def trailing_comments; end - # Mirrors the Method#parameters method. + # Returns a list of nodes that are descendants of this node that contain the + # given line and column. This is useful for locating a node that is selected + # based on the line and column of the source code. # - # source://prism//lib/prism/node_ext.rb#210 - sig { returns(T::Array[T.any([Symbol, Symbol], [Symbol])]) } - def signature; end + # Important to note is that the column given to this method should be in + # bytes, as opposed to characters or code units. + # + # source://prism//lib/prism/node.rb#191 + sig { params(line: Integer, column: Integer).returns(T::Array[Prism::Node]) } + def tunnel(line, column); end # Sometimes you want to check an instance of a node against a list of # classes to see what kind of behavior to perform. Usually this is done by @@ -25234,7049 +26968,7556 @@ class Prism::ParametersNode < ::Prism::Node # you can take advantage of the fact that case statements with all symbol # keys will use a jump table. # - # def type: () -> Symbol + # @raise [NoMethodError] # - # source://prism//lib/prism/node.rb#15574 - sig { override.returns(Symbol) } + # source://prism//lib/prism/node.rb#299 + sig { abstract.returns(Symbol) } def type; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15584 - def type; end - end -end + protected -# Represents a parenthesized expression -# -# (10 + 34) -# ^^^^^^^^^ -# -# source://prism//lib/prism/node.rb#15610 -class Prism::ParenthesesNode < ::Prism::Node - # def initialize: (Prism::node? body, Location opening_loc, Location closing_loc, Location location) -> void - # - # @return [ParenthesesNode] a new instance of ParenthesesNode + # An bitset of flags for this node. There are certain flags that are common + # for all nodes, and then some nodes have specific flags. # - # source://prism//lib/prism/node.rb#15612 - sig do - params( - source: Prism::Source, - body: T.nilable(Prism::Node), - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location + # source://prism//lib/prism/node.rb#157 + sig { returns(Integer) } + def flags; end + + private + + # A pointer to the source that this node was created from. + # + # source://prism//lib/prism/node.rb#14 + sig { returns(Prism::Source) } + def source; end + + class << self + # Returns a list of the fields that exist for this node class. Fields + # describe the structure of the node. This kind of reflection is useful for + # things like recursively visiting each node _and_ field in the tree. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#242 + def fields; end + + # Similar to #type, this method returns a symbol that you can use for + # splitting on the type of the node without having to do a long === chain. + # Note that like #type, it will still be slower than using == for a single + # class, but should be faster in a case statement or an array comparison. + # + # @raise [NoMethodError] + # + # source://prism//lib/prism/node.rb#307 + def type; end + end +end + +# The flags that are common to all nodes. +# +# source://prism//lib/prism/node.rb#18636 +module Prism::NodeFlags; end + +# A flag to indicate that the node is a candidate to emit a :line event +# through tracepoint when compiled. +# +# source://prism//lib/prism/node.rb#18639 +Prism::NodeFlags::NEWLINE = T.let(T.unsafe(nil), Integer) + +# A flag to indicate that the value that the node represents is a value that +# can be determined at parse-time. +# +# source://prism//lib/prism/node.rb#18643 +Prism::NodeFlags::STATIC_LITERAL = T.let(T.unsafe(nil), Integer) + +# Represents an implicit set of parameters through the use of numbered parameters within a block or lambda. +# +# -> { _1 + _2 } +# ^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#13661 +class Prism::NumberedParametersNode < ::Prism::Node + # Initialize a new NumberedParametersNode node. + # + # @return [NumberedParametersNode] a new instance of NumberedParametersNode + # + # source://prism//lib/prism/node.rb#13663 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + maximum: Integer ).void end - def initialize(source, body, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, maximum); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#15731 + # source://prism//lib/prism/node.rb#13724 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#15622 + # source://prism//lib/prism/node.rb#13672 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? - # - # source://prism//lib/prism/node.rb#15661 - sig { returns(T.nilable(Prism::Node)) } - def body; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15631 + # source://prism//lib/prism/node.rb#13677 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String - # - # source://prism//lib/prism/node.rb#15683 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#15671 - sig { returns(Prism::Location) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#15643 + # source://prism//lib/prism/node.rb#13687 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#15636 + # source://prism//lib/prism/node.rb#13682 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location, ?location: Location) -> ParenthesesNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode # - # source://prism//lib/prism/node.rb#15648 + # source://prism//lib/prism/node.rb#13692 sig do params( - body: T.nilable(Prism::Node), - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::ParenthesesNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + maximum: Integer + ).returns(Prism::NumberedParametersNode) end - def copy(body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), maximum: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15631 + # source://prism//lib/prism/node.rb#13677 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { body: Prism::node?, opening_loc: Location, closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, maximum: Integer } # - # source://prism//lib/prism/node.rb#15656 + # source://prism//lib/prism/node.rb#13700 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#15688 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def opening: () -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#15678 - sig { returns(String) } - def opening; end + # source://prism//lib/prism/node.rb#13708 + sig { override.returns(String) } + def inspect; end - # attr_reader opening_loc: Location + # attr_reader maximum: Integer # - # source://prism//lib/prism/node.rb#15664 - sig { returns(Prism::Location) } - def opening_loc; end - - # source://prism//lib/prism/node.rb#15626 - def set_newline_flag(newline_marked); end + # source://prism//lib/prism/node.rb#13705 + sig { returns(Integer) } + def maximum; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15715 + # source://prism//lib/prism/node.rb#13713 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#15725 + # source://prism//lib/prism/node.rb#13718 def type; end end end -# This represents an error that was encountered during parsing. +# Represents reading a numbered reference to a capture in the previous match. # -# source://prism//lib/prism/parse_result.rb#373 -class Prism::ParseError - # Create a new error object with the given message and location. - # - # @return [ParseError] a new instance of ParseError +# $1 +# ^^ +# +# source://prism//lib/prism/node.rb#13734 +class Prism::NumberedReferenceReadNode < ::Prism::Node + # Initialize a new NumberedReferenceReadNode node. # - # source://prism//lib/prism/parse_result.rb#388 - sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } - def initialize(type, message, location, level); end - - # Implement the hash pattern matching interface for ParseError. + # @return [NumberedReferenceReadNode] a new instance of NumberedReferenceReadNode # - # source://prism//lib/prism/parse_result.rb#396 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#13736 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + number: Integer + ).void + end + def initialize(source, node_id, location, flags, number); end - # Returns a string representation of this error. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result.rb#401 - sig { returns(String) } - def inspect; end + # source://prism//lib/prism/node.rb#13803 + def ===(other); end - # The level of this error. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result.rb#385 - sig { returns(Symbol) } - def level; end + # source://prism//lib/prism/node.rb#13745 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # A Location object representing the location of this error in the source. + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result.rb#382 - sig { returns(Prism::Location) } - def location; end + # source://prism//lib/prism/node.rb#13750 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # The message associated with this error. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/parse_result.rb#379 - sig { returns(String) } - def message; end + # source://prism//lib/prism/node.rb#13760 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # The type of error. This is an _internal_ symbol that is used for - # communicating with translation layers. It is not meant to be public API. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/parse_result.rb#376 - sig { returns(Symbol) } - def type; end -end + # source://prism//lib/prism/node.rb#13755 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end -# This is a result specific to the `parse_lex` and `parse_lex_file` methods. -# -# source://prism//lib/prism/parse_result.rb#532 -class Prism::ParseLexResult < ::Prism::Result - # Create a new parse lex result object with the given values. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode # - # @return [ParseLexResult] a new instance of ParseLexResult - # - # source://prism//lib/prism/parse_result.rb#538 + # source://prism//lib/prism/node.rb#13765 sig do params( - value: [Prism::ProgramNode, T::Array[T.untyped]], - comments: T::Array[Prism::Comment], - magic_comments: T::Array[Prism::MagicComment], - data_loc: T.nilable(Prism::Location), - errors: T::Array[Prism::ParseError], - warnings: T::Array[Prism::ParseWarning], - source: Prism::Source - ).void + node_id: Integer, + location: Prism::Location, + flags: Integer, + number: Integer + ).returns(Prism::NumberedReferenceReadNode) end - def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), number: T.unsafe(nil)); end - # Implement the hash pattern matching interface for ParseLexResult. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#13750 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end + + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, number: Integer } # - # source://prism//lib/prism/parse_result.rb#544 + # source://prism//lib/prism/node.rb#13773 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # A tuple of the syntax tree and the list of tokens that were parsed from - # the source code. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/parse_result.rb#535 - sig { returns([Prism::ProgramNode, T::Array[T.untyped]]) } - def value; end + # source://prism//lib/prism/node.rb#13787 + sig { override.returns(String) } + def inspect; end + + # The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`. + # + # $1 # number `1` + # + # $5432 # number `5432` + # + # $4294967296 # number `0` + # + # source://prism//lib/prism/node.rb#13784 + sig { returns(Integer) } + def number; end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#13792 + sig { override.returns(Symbol) } + def type; end + + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#13797 + def type; end + end end -# This is a result specific to the `parse` and `parse_file` methods. +# Represents an optional keyword parameter to a method, block, or lambda definition. # -# source://prism//lib/prism/parse_result.rb#498 -class Prism::ParseResult < ::Prism::Result - # Create a new parse result object with the given values. +# def a(b: 1) +# ^^^^ +# end +# +# source://prism//lib/prism/node.rb#13814 +class Prism::OptionalKeywordParameterNode < ::Prism::Node + # Initialize a new OptionalKeywordParameterNode node. # - # @return [ParseResult] a new instance of ParseResult + # @return [OptionalKeywordParameterNode] a new instance of OptionalKeywordParameterNode # - # source://prism//lib/prism/parse_result.rb#503 + # source://prism//lib/prism/node.rb#13816 sig do params( - value: Prism::ProgramNode, - comments: T::Array[Prism::Comment], - magic_comments: T::Array[Prism::MagicComment], - data_loc: T.nilable(Prism::Location), - errors: T::Array[Prism::ParseError], - warnings: T::Array[Prism::ParseWarning], - source: Prism::Source + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node ).void end - def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end + def initialize(source, node_id, location, flags, name, name_loc, value); end - # Attach the list of comments to their respective locations in the tree. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result/comments.rb#190 - def attach_comments!; end + # source://prism//lib/prism/node.rb#13900 + def ===(other); end - # Implement the hash pattern matching interface for ParseResult. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result.rb#509 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#13827 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Walk the tree and mark nodes that are on a new line. + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result/newlines.rb#60 - def mark_newlines!; end + # source://prism//lib/prism/node.rb#13832 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # The syntax tree that was parsed from the source code. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/parse_result.rb#500 - sig { returns(Prism::ProgramNode) } - def value; end -end + # source://prism//lib/prism/node.rb#13842 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end -# When we've parsed the source, we have both the syntax tree and the list of -# comments that we found in the source. This class is responsible for -# walking the tree and finding the nearest location to attach each comment. -# -# It does this by first finding the nearest locations to each comment. -# Locations can either come from nodes directly or from location fields on -# nodes. For example, a `ClassNode` has an overall location encompassing the -# entire class, but it also has a location for the `class` keyword. -# -# Once the nearest locations are found, it determines which one to attach -# to. If it's a trailing comment (a comment on the same line as other source -# code), it will favor attaching to the nearest location that occurs before -# the comment. Otherwise it will favor attaching to the nearest location -# that is after the comment. -# -# source://prism//lib/prism/parse_result/comments.rb#19 -class Prism::ParseResult::Comments - # Create a new Comments object that will attach comments to the given - # parse result. + # def compact_child_nodes: () -> Array[Node] # - # @return [Comments] a new instance of Comments + # source://prism//lib/prism/node.rb#13837 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end + + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode # - # source://prism//lib/prism/parse_result/comments.rb#86 - def initialize(parse_result); end + # source://prism//lib/prism/node.rb#13847 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::OptionalKeywordParameterNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil)); end - # Attach the comments to their respective locations in the tree by - # mutating the parse result. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result/comments.rb#92 - def attach!; end + # source://prism//lib/prism/node.rb#13832 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # The parse result that we are attaching comments to. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node } # - # source://prism//lib/prism/parse_result/comments.rb#82 - def parse_result; end + # source://prism//lib/prism/node.rb#13855 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - private + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Responsible for finding the nearest targets to the given comment within - # the context of the given encapsulating node. + # def inspect -> String # - # source://prism//lib/prism/parse_result/comments.rb#119 - def nearest_targets(node, comment); end -end + # source://prism//lib/prism/node.rb#13884 + sig { override.returns(String) } + def inspect; end -# A target for attaching comments that is based on a location field on a -# node. For example, the `end` token of a ClassNode. -# -# source://prism//lib/prism/parse_result/comments.rb#53 -class Prism::ParseResult::Comments::LocationTarget - # @return [LocationTarget] a new instance of LocationTarget + # attr_reader name: Symbol # - # source://prism//lib/prism/parse_result/comments.rb#56 - def initialize(location); end + # source://prism//lib/prism/node.rb#13865 + sig { returns(Symbol) } + def name; end - # @return [Boolean] + # attr_reader name_loc: Location # - # source://prism//lib/prism/parse_result/comments.rb#68 - def encloses?(comment); end - - # source://prism//lib/prism/parse_result/comments.rb#64 - def end_offset; end - - # source://prism//lib/prism/parse_result/comments.rb#72 - def leading_comment(comment); end - - # source://prism//lib/prism/parse_result/comments.rb#54 - def location; end - - # source://prism//lib/prism/parse_result/comments.rb#60 - def start_offset; end - - # source://prism//lib/prism/parse_result/comments.rb#76 - def trailing_comment(comment); end -end + # source://prism//lib/prism/node.rb#13868 + sig { returns(Prism::Location) } + def name_loc; end -# A target for attaching comments that is based on a specific node's -# location. -# -# source://prism//lib/prism/parse_result/comments.rb#22 -class Prism::ParseResult::Comments::NodeTarget - # @return [NodeTarget] a new instance of NodeTarget + # def repeated_parameter?: () -> bool # - # source://prism//lib/prism/parse_result/comments.rb#25 - def initialize(node); end - # @return [Boolean] # - # source://prism//lib/prism/parse_result/comments.rb#37 - def encloses?(comment); end - - # source://prism//lib/prism/parse_result/comments.rb#33 - def end_offset; end + # source://prism//lib/prism/node.rb#13860 + sig { returns(T::Boolean) } + def repeated_parameter?; end - # source://prism//lib/prism/parse_result/comments.rb#42 - def leading_comment(comment); end + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#13876 + def save_name_loc(repository); end - # source://prism//lib/prism/parse_result/comments.rb#23 - def node; end + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#13889 + sig { override.returns(Symbol) } + def type; end - # source://prism//lib/prism/parse_result/comments.rb#29 - def start_offset; end + # attr_reader value: Prism::node + # + # source://prism//lib/prism/node.rb#13881 + sig { returns(Prism::Node) } + def value; end - # source://prism//lib/prism/parse_result/comments.rb#46 - def trailing_comment(comment); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#13894 + def type; end + end end -# The :line tracepoint event gets fired whenever the Ruby VM encounters an -# expression on a new line. The types of expressions that can trigger this -# event are: -# -# * if statements -# * unless statements -# * nodes that are children of statements lists -# -# In order to keep track of the newlines, we have a list of offsets that -# come back from the parser. We assign these offsets to the first nodes that -# we find in the tree that are on those lines. +# Represents an optional parameter to a method, block, or lambda definition. # -# Note that the logic in this file should be kept in sync with the Java -# MarkNewlinesVisitor, since that visitor is responsible for marking the -# newlines for JRuby/TruffleRuby. +# def a(b = 1) +# ^^^^^ +# end # -# source://prism//lib/prism/parse_result/newlines.rb#20 -class Prism::ParseResult::Newlines < ::Prism::Visitor - # Create a new Newlines visitor with the given newline offsets. +# source://prism//lib/prism/node.rb#13914 +class Prism::OptionalParameterNode < ::Prism::Node + # Initialize a new OptionalParameterNode node. # - # @return [Newlines] a new instance of Newlines + # @return [OptionalParameterNode] a new instance of OptionalParameterNode # - # source://prism//lib/prism/parse_result/newlines.rb#22 - def initialize(newline_marked); end + # source://prism//lib/prism/node.rb#13916 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end - # Permit block/lambda nodes to mark newlines within themselves. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result/newlines.rb#27 - def visit_block_node(node); end + # source://prism//lib/prism/node.rb#14019 + def ===(other); end - # Mark if/unless nodes as newlines. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result/newlines.rb#41 - def visit_if_node(node); end + # source://prism//lib/prism/node.rb#13928 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Permit block/lambda nodes to mark newlines within themselves. + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result/newlines.rb#27 - def visit_lambda_node(node); end + # source://prism//lib/prism/node.rb#13933 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Permit statements lists to mark newlines within themselves. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/parse_result/newlines.rb#49 - def visit_statements_node(node); end + # source://prism//lib/prism/node.rb#13943 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Mark if/unless nodes as newlines. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/parse_result/newlines.rb#41 - def visit_unless_node(node); end -end + # source://prism//lib/prism/node.rb#13938 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end -# This represents a warning that was encountered during parsing. -# -# source://prism//lib/prism/parse_result.rb#407 -class Prism::ParseWarning - # Create a new warning object with the given message and location. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode # - # @return [ParseWarning] a new instance of ParseWarning + # source://prism//lib/prism/node.rb#13948 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::OptionalParameterNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/parse_result.rb#422 - sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } - def initialize(type, message, location, level); end + # source://prism//lib/prism/node.rb#13933 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Implement the hash pattern matching interface for ParseWarning. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # - # source://prism//lib/prism/parse_result.rb#430 + # source://prism//lib/prism/node.rb#13956 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # Returns a string representation of this warning. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/parse_result.rb#435 - sig { returns(String) } + # source://prism//lib/prism/node.rb#14003 + sig { override.returns(String) } def inspect; end - # The level of this warning. + # attr_reader name: Symbol # - # source://prism//lib/prism/parse_result.rb#419 + # source://prism//lib/prism/node.rb#13966 sig { returns(Symbol) } - def level; end + def name; end - # A Location object representing the location of this warning in the source. + # attr_reader name_loc: Location # - # source://prism//lib/prism/parse_result.rb#416 + # source://prism//lib/prism/node.rb#13969 sig { returns(Prism::Location) } - def location; end + def name_loc; end - # The message associated with this warning. + # def operator: () -> String # - # source://prism//lib/prism/parse_result.rb#413 + # source://prism//lib/prism/node.rb#13998 sig { returns(String) } - def message; end + def operator; end - # The type of warning. This is an _internal_ symbol that is used for - # communicating with translation layers. It is not meant to be public API. + # attr_reader operator_loc: Location # - # source://prism//lib/prism/parse_result.rb#410 - sig { returns(Symbol) } - def type; end -end + # source://prism//lib/prism/node.rb#13982 + sig { returns(Prism::Location) } + def operator_loc; end -# A pattern is an object that wraps a Ruby pattern matching expression. The -# expression would normally be passed to an `in` clause within a `case` -# expression or a rightward assignment expression. For example, in the -# following snippet: -# -# case node -# in ConstantPathNode[ConstantReadNode[name: :Prism], ConstantReadNode[name: :Pattern]] -# end -# -# the pattern is the ConstantPathNode[...] expression. -# -# The pattern gets compiled into an object that responds to #call by running -# the #compile method. This method itself will run back through Prism to -# parse the expression into a tree, then walk the tree to generate the -# necessary callable objects. For example, if you wanted to compile the -# expression above into a callable, you would: -# -# callable = Prism::Pattern.new("ConstantPathNode[ConstantReadNode[name: :Prism], ConstantReadNode[name: :Pattern]]").compile -# callable.call(node) -# -# The callable object returned by #compile is guaranteed to respond to #call -# with a single argument, which is the node to match against. It also is -# guaranteed to respond to #===, which means it itself can be used in a `case` -# expression, as in: -# -# case node -# when callable -# end -# -# If the query given to the initializer cannot be compiled into a valid -# matcher (either because of a syntax error or because it is using syntax we -# do not yet support) then a Prism::Pattern::CompilationError will be -# raised. -# -# source://prism//lib/prism/pattern.rb#37 -class Prism::Pattern - # Create a new pattern with the given query. The query should be a string - # containing a Ruby pattern matching expression. - # - # @return [Pattern] a new instance of Pattern - # - # source://prism//lib/prism/pattern.rb#63 - def initialize(query); end - - # Compile the query into a callable object that can be used to match against - # nodes. - # - # @raise [CompilationError] - # - # source://prism//lib/prism/pattern.rb#70 - def compile; end - - # The query that this pattern was initialized with. - # - # source://prism//lib/prism/pattern.rb#59 - def query; end - - # Scan the given node and all of its children for nodes that match the - # pattern. If a block is given, it will be called with each node that - # matches the pattern. If no block is given, an enumerator will be returned - # that will yield each node that matches the pattern. - # - # source://prism//lib/prism/pattern.rb#86 - def scan(root); end - - private - - # Shortcut for combining two procs into one that returns true if both return - # true. - # - # source://prism//lib/prism/pattern.rb#102 - def combine_and(left, right); end - - # Shortcut for combining two procs into one that returns true if either - # returns true. - # - # source://prism//lib/prism/pattern.rb#108 - def combine_or(left, right); end - - # in foo | bar - # - # source://prism//lib/prism/pattern.rb#143 - def compile_alternation_pattern_node(node); end - - # in [foo, bar, baz] - # - # source://prism//lib/prism/pattern.rb#118 - def compile_array_pattern_node(node); end - - # in Prism::ConstantReadNode - # - # source://prism//lib/prism/pattern.rb#148 - def compile_constant_path_node(node); end - - # in ConstantReadNode - # in String - # - # source://prism//lib/prism/pattern.rb#160 - def compile_constant_read_node(node); end - - # Raise an error because the given node is not supported. - # - # @raise [CompilationError] - # - # source://prism//lib/prism/pattern.rb#113 - def compile_error(node); end - - # in InstanceVariableReadNode[name: Symbol] - # in { name: Symbol } + # def repeated_parameter?: () -> bool # - # source://prism//lib/prism/pattern.rb#178 - def compile_hash_pattern_node(node); end - - # in nil + # @return [Boolean] # - # source://prism//lib/prism/pattern.rb#208 - def compile_nil_node(node); end + # source://prism//lib/prism/node.rb#13961 + sig { returns(T::Boolean) } + def repeated_parameter?; end - # Compile any kind of node. Dispatch out to the individual compilation - # methods based on the type of node. + # Save the name_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/pattern.rb#237 - def compile_node(node); end + # source://prism//lib/prism/node.rb#13977 + def save_name_loc(repository); end - # in /foo/ + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/pattern.rb#213 - def compile_regular_expression_node(node); end + # source://prism//lib/prism/node.rb#13990 + def save_operator_loc(repository); end - # in "" - # in "foo" + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/pattern.rb#221 - def compile_string_node(node); end + # source://prism//lib/prism/node.rb#14008 + sig { override.returns(Symbol) } + def type; end - # in :+ - # in :foo + # attr_reader value: Prism::node # - # source://prism//lib/prism/pattern.rb#229 - def compile_symbol_node(node); end -end + # source://prism//lib/prism/node.rb#13995 + sig { returns(Prism::Node) } + def value; end -# Raised when the query given to a pattern is either invalid Ruby syntax or -# is using syntax that we don't yet support. -# -# source://prism//lib/prism/pattern.rb#40 -class Prism::Pattern::CompilationError < ::StandardError - # Create a new CompilationError with the given representation of the node - # that caused the error. - # - # @return [CompilationError] a new instance of CompilationError - # - # source://prism//lib/prism/pattern.rb#43 - def initialize(repr); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#14013 + def type; end + end end -# Represents the use of the `^` operator for pinning an expression in a pattern matching expression. +# Represents the use of the `||` operator or the `or` keyword. # -# foo in ^(bar) -# ^^^^^^ +# left or right +# ^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#15743 -class Prism::PinnedExpressionNode < ::Prism::Node - # def initialize: (Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc, Location location) -> void +# source://prism//lib/prism/node.rb#14033 +class Prism::OrNode < ::Prism::Node + # Initialize a new OrNode node. # - # @return [PinnedExpressionNode] a new instance of PinnedExpressionNode + # @return [OrNode] a new instance of OrNode # - # source://prism//lib/prism/node.rb#15745 + # source://prism//lib/prism/node.rb#14035 sig do params( source: Prism::Source, - expression: Prism::Node, - operator_loc: Prism::Location, - lparen_loc: Prism::Location, - rparen_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location ).void end - def initialize(source, expression, operator_loc, lparen_loc, rparen_loc, location); end + def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#15868 + # source://prism//lib/prism/node.rb#14134 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#15756 + # source://prism//lib/prism/node.rb#14046 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15761 + # source://prism//lib/prism/node.rb#14051 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#15771 + # source://prism//lib/prism/node.rb#14061 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#15766 + # source://prism//lib/prism/node.rb#14056 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location, ?location: Location) -> PinnedExpressionNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode # - # source://prism//lib/prism/node.rb#15776 + # source://prism//lib/prism/node.rb#14066 sig do params( - expression: Prism::Node, - operator_loc: Prism::Location, - lparen_loc: Prism::Location, - rparen_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::PinnedExpressionNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::OrNode) end - def copy(expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#15761 + # source://prism//lib/prism/node.rb#14051 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { expression: Prism::node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # - # source://prism//lib/prism/node.rb#15784 + # source://prism//lib/prism/node.rb#14074 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader expression: Prism::node - # - # source://prism//lib/prism/node.rb#15789 - sig { returns(Prism::Node) } - def expression; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#15828 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14118 + sig { override.returns(String) } + def inspect; end - # def lparen: () -> String + # Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#15818 - sig { returns(String) } - def lparen; end - - # attr_reader lparen_loc: Location + # left or right + # ^^^^ # - # source://prism//lib/prism/node.rb#15799 - sig { returns(Prism::Location) } - def lparen_loc; end + # 1 || 2 + # ^ + # + # source://prism//lib/prism/node.rb#14085 + sig { returns(Prism::Node) } + def left; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#15813 + # source://prism//lib/prism/node.rb#14113 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # The location of the `or` keyword or the `||` operator. + # + # left or right + # ^^ # - # source://prism//lib/prism/node.rb#15792 + # source://prism//lib/prism/node.rb#14100 sig { returns(Prism::Location) } def operator_loc; end - # def rparen: () -> String + # Represents the right side of the expression. # - # source://prism//lib/prism/node.rb#15823 - sig { returns(String) } - def rparen; end - - # attr_reader rparen_loc: Location + # left || right + # ^^^^^ # - # source://prism//lib/prism/node.rb#15806 - sig { returns(Prism::Location) } - def rparen_loc; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # 1 or 2 + # ^ # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#14094 + sig { returns(Prism::Node) } + def right; end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#14108 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#15852 + # source://prism//lib/prism/node.rb#14123 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#15862 + # source://prism//lib/prism/node.rb#14128 def type; end end end -# Represents the use of the `^` operator for pinning a variable in a pattern matching expression. -# -# foo in ^bar -# ^^^^ +# A parser for the pack template language. # -# source://prism//lib/prism/node.rb#15881 -class Prism::PinnedVariableNode < ::Prism::Node - # def initialize: (Prism::node variable, Location operator_loc, Location location) -> void - # - # @return [PinnedVariableNode] a new instance of PinnedVariableNode - # - # source://prism//lib/prism/node.rb#15883 - sig do - params( - source: Prism::Source, - variable: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).void +# source://prism//lib/prism/pack.rb#6 +module Prism::Pack + class << self + def parse(_arg0, _arg1, _arg2); end end - def initialize(source, variable, operator_loc, location); end +end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. - # - # source://prism//lib/prism/node.rb#15978 - def ===(other); end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::AGNOSTIC_ENDIAN = T.let(T.unsafe(nil), Symbol) - # def accept: (Visitor visitor) -> void - # - # source://prism//lib/prism/node.rb#15892 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::BACK = T.let(T.unsafe(nil), Symbol) - # def child_nodes: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#15897 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::BER = T.let(T.unsafe(nil), Symbol) - # def comment_targets: () -> Array[Node | Location] - # - # source://prism//lib/prism/node.rb#15907 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::BIG_ENDIAN = T.let(T.unsafe(nil), Symbol) - # def compact_child_nodes: () -> Array[Node] - # - # source://prism//lib/prism/node.rb#15902 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::COMMENT = T.let(T.unsafe(nil), Symbol) - # def copy: (?variable: Prism::node, ?operator_loc: Location, ?location: Location) -> PinnedVariableNode +# A directive in the pack template language. +# +# source://prism//lib/prism/pack.rb#60 +class Prism::Pack::Directive + # Initialize a new directive with the given values. # - # source://prism//lib/prism/node.rb#15912 - sig do - params( - variable: Prism::Node, - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::PinnedVariableNode) - end - def copy(variable: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end - - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # @return [Directive] a new instance of Directive # - # source://prism//lib/prism/node.rb#15897 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/pack.rb#89 + def initialize(version, variant, source, type, signed, endian, size, length_type, length); end - # def deconstruct_keys: (Array[Symbol] keys) -> { variable: Prism::node, operator_loc: Location, location: Location } + # Provide a human-readable description of the directive. # - # source://prism//lib/prism/node.rb#15920 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/pack.rb#131 + def describe; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # The type of endianness of the directive. + # + # source://prism//lib/prism/pack.rb#77 + def endian; end - # def inspect(NodeInspector inspector) -> String + # The length of this directive (used for integers). # - # source://prism//lib/prism/node.rb#15940 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/pack.rb#86 + def length; end - # def operator: () -> String + # The length type of this directive (used for integers). # - # source://prism//lib/prism/node.rb#15935 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/pack.rb#83 + def length_type; end - # attr_reader operator_loc: Location + # The type of signedness of the directive. # - # source://prism//lib/prism/node.rb#15928 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/pack.rb#74 + def signed; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # The size of the directive. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/pack.rb#80 + def size; end + + # A byteslice of the source string that this directive represents. # - # def type: () -> Symbol + # source://prism//lib/prism/pack.rb#68 + def source; end + + # The type of the directive. # - # source://prism//lib/prism/node.rb#15962 - sig { override.returns(Symbol) } + # source://prism//lib/prism/pack.rb#71 def type; end - # attr_reader variable: Prism::node + # A symbol representing whether or not we are packing or unpacking. # - # source://prism//lib/prism/node.rb#15925 - sig { returns(Prism::Node) } - def variable; end + # source://prism//lib/prism/pack.rb#65 + def variant; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#15972 - def type; end - end + # A symbol representing the version of Ruby. + # + # source://prism//lib/prism/pack.rb#62 + def version; end end -# Represents the use of the `END` keyword. +# The descriptions of the various types of endianness. # -# END { foo } -# ^^^^^^^^^^^ +# source://prism//lib/prism/pack.rb#102 +Prism::Pack::Directive::ENDIAN_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) + +# The descriptions of the various types of signedness. # -# source://prism//lib/prism/node.rb#15989 -class Prism::PostExecutionNode < ::Prism::Node - # def initialize: (StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc, Location location) -> void - # - # @return [PostExecutionNode] a new instance of PostExecutionNode - # - # source://prism//lib/prism/node.rb#15991 - sig do - params( - source: Prism::Source, - statements: T.nilable(Prism::StatementsNode), - keyword_loc: Prism::Location, - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location - ).void - end - def initialize(source, statements, keyword_loc, opening_loc, closing_loc, location); end +# source://prism//lib/prism/pack.rb#111 +Prism::Pack::Directive::SIGNED_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. - # - # source://prism//lib/prism/node.rb#16120 - def ===(other); end +# The descriptions of the various types of sizes. +# +# source://prism//lib/prism/pack.rb#118 +Prism::Pack::Directive::SIZE_DESCRIPTIONS = T.let(T.unsafe(nil), Hash) - # def accept: (Visitor visitor) -> void - # - # source://prism//lib/prism/node.rb#16002 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::ENDIAN_NA = T.let(T.unsafe(nil), Symbol) - # def child_nodes: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#16007 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::FLOAT = T.let(T.unsafe(nil), Symbol) - # def closing: () -> String +# The result of parsing a pack template. +# +# source://prism//lib/prism/pack.rb#198 +class Prism::Pack::Format + # Create a new Format with the given directives and encoding. # - # source://prism//lib/prism/node.rb#16071 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location + # @return [Format] a new instance of Format # - # source://prism//lib/prism/node.rb#16054 - sig { returns(Prism::Location) } - def closing_loc; end + # source://prism//lib/prism/pack.rb#206 + def initialize(directives, encoding); end - # def comment_targets: () -> Array[Node | Location] + # Provide a human-readable description of the format. # - # source://prism//lib/prism/node.rb#16019 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/pack.rb#212 + def describe; end - # def compact_child_nodes: () -> Array[Node] + # A list of the directives in the template. # - # source://prism//lib/prism/node.rb#16012 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/pack.rb#200 + def directives; end - # def copy: (?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?location: Location) -> PostExecutionNode + # The encoding of the template. # - # source://prism//lib/prism/node.rb#16024 - sig do - params( - statements: T.nilable(Prism::StatementsNode), - keyword_loc: Prism::Location, - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::PostExecutionNode) - end - def copy(statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/pack.rb#203 + def encoding; end +end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#16007 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::INTEGER = T.let(T.unsafe(nil), Symbol) - # def deconstruct_keys: (Array[Symbol] keys) -> { statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location } - # - # source://prism//lib/prism/node.rb#16032 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::LENGTH_FIXED = T.let(T.unsafe(nil), Symbol) - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::LENGTH_MAX = T.let(T.unsafe(nil), Symbol) - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#16076 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::LENGTH_NA = T.let(T.unsafe(nil), Symbol) - # def keyword: () -> String - # - # source://prism//lib/prism/node.rb#16061 - sig { returns(String) } - def keyword; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::LENGTH_RELATIVE = T.let(T.unsafe(nil), Symbol) - # attr_reader keyword_loc: Location - # - # source://prism//lib/prism/node.rb#16040 - sig { returns(Prism::Location) } - def keyword_loc; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::LITTLE_ENDIAN = T.let(T.unsafe(nil), Symbol) - # def opening: () -> String - # - # source://prism//lib/prism/node.rb#16066 - sig { returns(String) } - def opening; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::MOVE = T.let(T.unsafe(nil), Symbol) - # attr_reader opening_loc: Location - # - # source://prism//lib/prism/node.rb#16047 - sig { returns(Prism::Location) } - def opening_loc; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::NATIVE_ENDIAN = T.let(T.unsafe(nil), Symbol) - # attr_reader statements: StatementsNode? - # - # source://prism//lib/prism/node.rb#16037 - sig { returns(T.nilable(Prism::StatementsNode)) } - def statements; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::NULL = T.let(T.unsafe(nil), Symbol) - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16104 - sig { override.returns(Symbol) } - def type; end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIGNED = T.let(T.unsafe(nil), Symbol) - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16114 - def type; end - end -end +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIGNED_NA = T.let(T.unsafe(nil), Symbol) -# Represents the use of the `BEGIN` keyword. +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_16 = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_32 = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_64 = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_8 = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_INT = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_LONG = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_LONG_LONG = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_NA = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_P = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SIZE_SHORT = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::SPACE = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_BASE64 = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_FIXED = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_HEX_HIGH = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_HEX_LOW = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_LSB = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_MIME = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_MSB = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_NULL_PADDED = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_NULL_TERMINATED = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_POINTER = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_SPACE_PADDED = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::STRING_UU = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::UNSIGNED = T.let(T.unsafe(nil), Symbol) + +# source://prism//lib/prism/pack.rb#56 +Prism::Pack::UTF8 = T.let(T.unsafe(nil), Symbol) + +# Flags for parameter nodes. # -# BEGIN { foo } -# ^^^^^^^^^^^^^ +# source://prism//lib/prism/node.rb#18543 +module Prism::ParameterFlags; end + +# a parameter name that has been repeated in the method signature # -# source://prism//lib/prism/node.rb#16133 -class Prism::PreExecutionNode < ::Prism::Node - # def initialize: (StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc, Location location) -> void +# source://prism//lib/prism/node.rb#18545 +Prism::ParameterFlags::REPEATED_PARAMETER = T.let(T.unsafe(nil), Integer) + +# Represents the list of parameters on a method, block, or lambda definition. +# +# def a(b, c, d) +# ^^^^^^^ +# end +# +# source://prism//lib/prism/node.rb#14147 +class Prism::ParametersNode < ::Prism::Node + # Initialize a new ParametersNode node. # - # @return [PreExecutionNode] a new instance of PreExecutionNode + # @return [ParametersNode] a new instance of ParametersNode # - # source://prism//lib/prism/node.rb#16135 + # source://prism//lib/prism/node.rb#14149 sig do params( source: Prism::Source, - statements: T.nilable(Prism::StatementsNode), - keyword_loc: Prism::Location, - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], + optionals: T::Array[Prism::OptionalParameterNode], + rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), + posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)], + keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], + keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), + block: T.nilable(Prism::BlockParameterNode) ).void end - def initialize(source, statements, keyword_loc, opening_loc, closing_loc, location); end + def initialize(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#16264 + # source://prism//lib/prism/node.rb#14242 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#16146 + # source://prism//lib/prism/node.rb#14164 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader block: BlockParameterNode? + # + # source://prism//lib/prism/node.rb#14223 + sig { returns(T.nilable(Prism::BlockParameterNode)) } + def block; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16151 + # source://prism//lib/prism/node.rb#14169 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String - # - # source://prism//lib/prism/node.rb#16215 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#16198 - sig { returns(Prism::Location) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#16163 + # source://prism//lib/prism/node.rb#14187 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#16156 + # source://prism//lib/prism/node.rb#14174 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?location: Location) -> PreExecutionNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: RestParameterNode | ImplicitRestNode | nil, ?posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, ?block: BlockParameterNode?) -> ParametersNode # - # source://prism//lib/prism/node.rb#16168 + # source://prism//lib/prism/node.rb#14192 sig do params( - statements: T.nilable(Prism::StatementsNode), - keyword_loc: Prism::Location, - opening_loc: Prism::Location, - closing_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::PreExecutionNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], + optionals: T::Array[Prism::OptionalParameterNode], + rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), + posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)], + keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], + keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), + block: T.nilable(Prism::BlockParameterNode) + ).returns(Prism::ParametersNode) end - def copy(statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16151 + # source://prism//lib/prism/node.rb#14169 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, requireds: Array[RequiredParameterNode | MultiTargetNode], optionals: Array[OptionalParameterNode], rest: RestParameterNode | ImplicitRestNode | nil, posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, block: BlockParameterNode? } # - # source://prism//lib/prism/node.rb#16176 + # source://prism//lib/prism/node.rb#14200 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#16220 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14226 + sig { override.returns(String) } + def inspect; end - # def keyword: () -> String + # attr_reader keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil # - # source://prism//lib/prism/node.rb#16205 - sig { returns(String) } - def keyword; end + # source://prism//lib/prism/node.rb#14220 + sig do + returns(T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode))) + end + def keyword_rest; end - # attr_reader keyword_loc: Location + # attr_reader keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] # - # source://prism//lib/prism/node.rb#16184 - sig { returns(Prism::Location) } - def keyword_loc; end + # source://prism//lib/prism/node.rb#14217 + sig { returns(T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)]) } + def keywords; end - # def opening: () -> String + # attr_reader optionals: Array[OptionalParameterNode] # - # source://prism//lib/prism/node.rb#16210 - sig { returns(String) } - def opening; end + # source://prism//lib/prism/node.rb#14208 + sig { returns(T::Array[Prism::OptionalParameterNode]) } + def optionals; end - # attr_reader opening_loc: Location + # attr_reader posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode] # - # source://prism//lib/prism/node.rb#16191 - sig { returns(Prism::Location) } - def opening_loc; end + # source://prism//lib/prism/node.rb#14214 + sig do + returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)]) + end + def posts; end - # attr_reader statements: StatementsNode? + # attr_reader requireds: Array[RequiredParameterNode | MultiTargetNode] # - # source://prism//lib/prism/node.rb#16181 - sig { returns(T.nilable(Prism::StatementsNode)) } - def statements; end + # source://prism//lib/prism/node.rb#14205 + sig { returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)]) } + def requireds; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # attr_reader rest: RestParameterNode | ImplicitRestNode | nil # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#14211 + sig { returns(T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode))) } + def rest; end + + # Mirrors the Method#parameters method. # - # def type: () -> Symbol + # source://prism//lib/prism/node_ext.rb#269 + sig { returns(T::Array[T.any([Symbol, Symbol], [Symbol])]) } + def signature; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#16248 + # source://prism//lib/prism/node.rb#14231 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16258 + # source://prism//lib/prism/node.rb#14236 def type; end end end -# The top level node of any parse tree. +# Represents a parenthesized expression # -# source://prism//lib/prism/node.rb#16274 -class Prism::ProgramNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, StatementsNode statements, Location location) -> void +# (10 + 34) +# ^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#14262 +class Prism::ParenthesesNode < ::Prism::Node + # Initialize a new ParenthesesNode node. # - # @return [ProgramNode] a new instance of ProgramNode + # @return [ParenthesesNode] a new instance of ParenthesesNode # - # source://prism//lib/prism/node.rb#16276 + # source://prism//lib/prism/node.rb#14264 sig do params( source: Prism::Source, - locals: T::Array[Symbol], - statements: Prism::StatementsNode, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T.nilable(Prism::Node), + opening_loc: Prism::Location, + closing_loc: Prism::Location ).void end - def initialize(source, locals, statements, location); end + def initialize(source, node_id, location, flags, body, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#16362 + # source://prism//lib/prism/node.rb#14370 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#16285 + # source://prism//lib/prism/node.rb#14275 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader body: Prism::node? + # + # source://prism//lib/prism/node.rb#14315 + sig { returns(T.nilable(Prism::Node)) } + def body; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16290 + # source://prism//lib/prism/node.rb#14280 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#14349 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#14331 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#16300 + # source://prism//lib/prism/node.rb#14292 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#16295 + # source://prism//lib/prism/node.rb#14285 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?locals: Array[Symbol], ?statements: StatementsNode, ?location: Location) -> ProgramNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode # - # source://prism//lib/prism/node.rb#16305 + # source://prism//lib/prism/node.rb#14297 sig do params( - locals: T::Array[Symbol], - statements: Prism::StatementsNode, - location: Prism::Location - ).returns(Prism::ProgramNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T.nilable(Prism::Node), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::ParenthesesNode) end - def copy(locals: T.unsafe(nil), statements: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16290 + # source://prism//lib/prism/node.rb#14280 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], statements: StatementsNode, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, body: Prism::node?, opening_loc: Location, closing_loc: Location } # - # source://prism//lib/prism/node.rb#16313 + # source://prism//lib/prism/node.rb#14305 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#16324 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14354 + sig { override.returns(String) } + def inspect; end - # attr_reader locals: Array[Symbol] + # def multiple_statements?: () -> bool # - # source://prism//lib/prism/node.rb#16318 - sig { returns(T::Array[Symbol]) } - def locals; end - - # attr_reader statements: StatementsNode + # @return [Boolean] # - # source://prism//lib/prism/node.rb#16321 - sig { returns(Prism::StatementsNode) } - def statements; end + # source://prism//lib/prism/node.rb#14310 + sig { returns(T::Boolean) } + def multiple_statements?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # source://prism//lib/prism/parse_result/newlines.rb#85 + def newline_flag!(lines); end + + # def opening: () -> String # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#14344 + sig { returns(String) } + def opening; end + + # attr_reader opening_loc: Location + # + # source://prism//lib/prism/node.rb#14318 + sig { returns(Prism::Location) } + def opening_loc; end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#14339 + def save_closing_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#14326 + def save_opening_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#16346 + # source://prism//lib/prism/node.rb#14359 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#16356 + # source://prism//lib/prism/node.rb#14364 def type; end end end -# Flags for range and flip-flop nodes. +# Flags for parentheses nodes. # -# source://prism//lib/prism/node.rb#20415 -module Prism::RangeFlags; end +# source://prism//lib/prism/node.rb#18549 +module Prism::ParenthesesNodeFlags; end -# ... operator +# parentheses that contain multiple potentially void statements # -# source://prism//lib/prism/node.rb#20417 -Prism::RangeFlags::EXCLUDE_END = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/node.rb#18551 +Prism::ParenthesesNodeFlags::MULTIPLE_STATEMENTS = T.let(T.unsafe(nil), Integer) -# Represents the use of the `..` or `...` operators. -# -# 1..2 -# ^^^^ -# -# c if a =~ /left/ ... b =~ /right/ -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# This represents an error that was encountered during parsing. # -# source://prism//lib/prism/node.rb#16377 -class Prism::RangeNode < ::Prism::Node - # def initialize: (Integer flags, Prism::node? left, Prism::node? right, Location operator_loc, Location location) -> void +# source://prism//lib/prism/parse_result.rb#609 +class Prism::ParseError + # Create a new error object with the given message and location. # - # @return [RangeNode] a new instance of RangeNode + # @return [ParseError] a new instance of ParseError # - # source://prism//lib/prism/node.rb#16379 - sig do - params( - source: Prism::Source, - flags: Integer, - left: T.nilable(Prism::Node), - right: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location - ).void - end - def initialize(source, flags, left, right, operator_loc, location); end + # source://prism//lib/prism/parse_result.rb#624 + sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } + def initialize(type, message, location, level); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Implement the hash pattern matching interface for ParseError. # - # source://prism//lib/prism/node.rb#16516 - def ===(other); end + # source://prism//lib/prism/parse_result.rb#632 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # def accept: (Visitor visitor) -> void + # Returns a string representation of this error. # - # source://prism//lib/prism/node.rb#16390 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/parse_result.rb#637 + sig { returns(String) } + def inspect; end - # def child_nodes: () -> Array[nil | Node] + # The level of this error. # - # source://prism//lib/prism/node.rb#16395 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/parse_result.rb#621 + sig { returns(Symbol) } + def level; end - # def comment_targets: () -> Array[Node | Location] + # A Location object representing the location of this error in the source. # - # source://prism//lib/prism/node.rb#16408 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/parse_result.rb#618 + sig { returns(Prism::Location) } + def location; end - # def compact_child_nodes: () -> Array[Node] + # The message associated with this error. # - # source://prism//lib/prism/node.rb#16400 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/parse_result.rb#615 + sig { returns(String) } + def message; end + + # The type of error. This is an _internal_ symbol that is used for + # communicating with translation layers. It is not meant to be public API. + # + # source://prism//lib/prism/parse_result.rb#612 + sig { returns(Symbol) } + def type; end +end - # def copy: (?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location, ?location: Location) -> RangeNode +# This is a result specific to the `parse_lex` and `parse_lex_file` methods. +# +# source://prism//lib/prism/parse_result.rb#798 +class Prism::ParseLexResult < ::Prism::Result + # Create a new parse lex result object with the given values. + # + # @return [ParseLexResult] a new instance of ParseLexResult # - # source://prism//lib/prism/node.rb#16413 + # source://prism//lib/prism/parse_result.rb#804 sig do params( - flags: Integer, - left: T.nilable(Prism::Node), - right: T.nilable(Prism::Node), - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::RangeNode) + value: [Prism::ProgramNode, T::Array[T.untyped]], + comments: T::Array[Prism::Comment], + magic_comments: T::Array[Prism::MagicComment], + data_loc: T.nilable(Prism::Location), + errors: T::Array[Prism::ParseError], + warnings: T::Array[Prism::ParseWarning], + source: Prism::Source + ).void end - def copy(flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end - - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#16395 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, left: Prism::node?, right: Prism::node?, operator_loc: Location, location: Location } + # Implement the hash pattern matching interface for ParseLexResult. # - # source://prism//lib/prism/node.rb#16421 + # source://prism//lib/prism/parse_result.rb#810 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def exclude_end?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#16456 - sig { returns(T::Boolean) } - def exclude_end?; end - - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end - - # def inspect(NodeInspector inspector) -> String + # A tuple of the syntax tree and the list of tokens that were parsed from + # the source code. # - # source://prism//lib/prism/node.rb#16466 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#801 + sig { returns([Prism::ProgramNode, T::Array[T.untyped]]) } + def value; end +end - # The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). - # - # 1... - # ^ +# This is a result specific to the `parse` and `parse_file` methods. +# +# source://prism//lib/prism/parse_result.rb#739 +class Prism::ParseResult < ::Prism::Result + # Create a new parse result object with the given values. # - # hello...goodbye - # ^^^^^ + # @return [ParseResult] a new instance of ParseResult # - # source://prism//lib/prism/node.rb#16436 - sig { returns(T.nilable(Prism::Node)) } - def left; end + # source://prism//lib/prism/parse_result.rb#752 + sig do + params( + value: Prism::ProgramNode, + comments: T::Array[Prism::Comment], + magic_comments: T::Array[Prism::MagicComment], + data_loc: T.nilable(Prism::Location), + errors: T::Array[Prism::ParseError], + warnings: T::Array[Prism::ParseWarning], + source: Prism::Source + ).void + end + def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end - # def operator: () -> String + # Attach the list of comments to their respective locations in the tree. # - # source://prism//lib/prism/node.rb#16461 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/parse_result.rb#763 + def attach_comments!; end - # The location of the `..` or `...` operator. + # Implement the hash pattern matching interface for ParseResult. # - # source://prism//lib/prism/node.rb#16449 - sig { returns(Prism::Location) } - def operator_loc; end + # source://prism//lib/prism/parse_result.rb#758 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). - # - # ..5 - # ^ + # Returns a string representation of the syntax tree with the errors + # displayed inline. # - # 1...foo - # ^^^ - # If neither right-hand or left-hand side was included, this will be a MissingNode. - # - # source://prism//lib/prism/node.rb#16446 - sig { returns(T.nilable(Prism::Node)) } - def right; end + # source://prism//lib/prism/parse_result.rb#775 + def errors_format; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Walk the tree and mark nodes that are on a new line, loosely emulating + # the behavior of CRuby's `:line` tracepoint event. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16500 - sig { override.returns(Symbol) } - def type; end - - protected + # source://prism//lib/prism/parse_result.rb#769 + def mark_newlines!; end - # protected attr_reader flags: Integer + # The syntax tree that was parsed from the source code. # - # source://prism//lib/prism/node.rb#16426 - sig { returns(Integer) } - def flags; end - - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16510 - def type; end - end + # source://prism//lib/prism/parse_result.rb#749 + sig { returns(Prism::ProgramNode) } + def value; end end -# Represents a rational number literal. +# When we've parsed the source, we have both the syntax tree and the list of +# comments that we found in the source. This class is responsible for +# walking the tree and finding the nearest location to attach each comment. # -# 1.0r -# ^^^^ +# It does this by first finding the nearest locations to each comment. +# Locations can either come from nodes directly or from location fields on +# nodes. For example, a `ClassNode` has an overall location encompassing the +# entire class, but it also has a location for the `class` keyword. # -# source://prism//lib/prism/node.rb#16529 -class Prism::RationalNode < ::Prism::Node - # def initialize: (Prism::node numeric, Location location) -> void +# Once the nearest locations are found, it determines which one to attach +# to. If it's a trailing comment (a comment on the same line as other source +# code), it will favor attaching to the nearest location that occurs before +# the comment. Otherwise it will favor attaching to the nearest location +# that is after the comment. +# +# source://prism//lib/prism/parse_result/comments.rb#19 +class Prism::ParseResult::Comments + # Create a new Comments object that will attach comments to the given + # parse result. # - # @return [RationalNode] a new instance of RationalNode + # @return [Comments] a new instance of Comments # - # source://prism//lib/prism/node.rb#16531 - sig { params(source: Prism::Source, numeric: Prism::Node, location: Prism::Location).void } - def initialize(source, numeric, location); end + # source://prism//lib/prism/parse_result/comments.rb#86 + def initialize(parse_result); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Attach the comments to their respective locations in the tree by + # mutating the parse result. # - # source://prism//lib/prism/node.rb#16612 - def ===(other); end + # source://prism//lib/prism/parse_result/comments.rb#92 + def attach!; end - # def accept: (Visitor visitor) -> void + # The parse result that we are attaching comments to. # - # source://prism//lib/prism/node.rb#16539 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/parse_result/comments.rb#82 + def parse_result; end - # def child_nodes: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#16544 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + private - # def comment_targets: () -> Array[Node | Location] + # Responsible for finding the nearest targets to the given comment within + # the context of the given encapsulating node. # - # source://prism//lib/prism/node.rb#16554 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/parse_result/comments.rb#119 + def nearest_targets(node, comment); end +end - # def compact_child_nodes: () -> Array[Node] +# A target for attaching comments that is based on a location field on a +# node. For example, the `end` token of a ClassNode. +# +# source://prism//lib/prism/parse_result/comments.rb#53 +class Prism::ParseResult::Comments::LocationTarget + # @return [LocationTarget] a new instance of LocationTarget # - # source://prism//lib/prism/node.rb#16549 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/parse_result/comments.rb#56 + def initialize(location); end - # def copy: (?numeric: Prism::node, ?location: Location) -> RationalNode + # @return [Boolean] # - # source://prism//lib/prism/node.rb#16559 - sig { params(numeric: Prism::Node, location: Prism::Location).returns(Prism::RationalNode) } - def copy(numeric: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/parse_result/comments.rb#68 + def encloses?(comment); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] - # - # source://prism//lib/prism/node.rb#16544 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/parse_result/comments.rb#64 + def end_offset; end - # def deconstruct_keys: (Array[Symbol] keys) -> { numeric: Prism::node, location: Location } - # - # source://prism//lib/prism/node.rb#16567 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/parse_result/comments.rb#72 + def leading_comment(comment); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # source://prism//lib/prism/parse_result/comments.rb#54 + def location; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#16575 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result/comments.rb#60 + def start_offset; end + + # source://prism//lib/prism/parse_result/comments.rb#76 + def trailing_comment(comment); end +end - # attr_reader numeric: Prism::node +# A target for attaching comments that is based on a specific node's +# location. +# +# source://prism//lib/prism/parse_result/comments.rb#22 +class Prism::ParseResult::Comments::NodeTarget + # @return [NodeTarget] a new instance of NodeTarget # - # source://prism//lib/prism/node.rb#16572 - sig { returns(Prism::Node) } - def numeric; end + # source://prism//lib/prism/parse_result/comments.rb#25 + def initialize(node); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # @return [Boolean] # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/parse_result/comments.rb#37 + def encloses?(comment); end + + # source://prism//lib/prism/parse_result/comments.rb#33 + def end_offset; end + + # source://prism//lib/prism/parse_result/comments.rb#42 + def leading_comment(comment); end + + # source://prism//lib/prism/parse_result/comments.rb#23 + def node; end + + # source://prism//lib/prism/parse_result/comments.rb#29 + def start_offset; end + + # source://prism//lib/prism/parse_result/comments.rb#46 + def trailing_comment(comment); end +end + +# An object to represent the set of errors on a parse result. This object +# can be used to format the errors in a human-readable way. +# +# source://prism//lib/prism/parse_result/errors.rb#9 +class Prism::ParseResult::Errors + # Initialize a new set of errors from the given parse result. # - # def type: () -> Symbol + # @return [Errors] a new instance of Errors # - # source://prism//lib/prism/node.rb#16596 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/parse_result/errors.rb#14 + def initialize(parse_result); end - # Returns the value of the node as a Ruby Rational. + # Formats the errors in a human-readable way and return them as a string. # - # source://prism//lib/prism/node_ext.rb#94 - sig { returns(Rational) } - def value; end + # source://prism//lib/prism/parse_result/errors.rb#19 + def format; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16606 - def type; end - end + # The parse result that contains the errors. + # + # source://prism//lib/prism/parse_result/errors.rb#11 + def parse_result; end end -# Represents the use of the `redo` keyword. +# The :line tracepoint event gets fired whenever the Ruby VM encounters an +# expression on a new line. The types of expressions that can trigger this +# event are: # -# redo -# ^^^^ +# * if statements +# * unless statements +# * nodes that are children of statements lists # -# source://prism//lib/prism/node.rb#16622 -class Prism::RedoNode < ::Prism::Node - # def initialize: (Location location) -> void +# In order to keep track of the newlines, we have a list of offsets that +# come back from the parser. We assign these offsets to the first nodes that +# we find in the tree that are on those lines. +# +# Note that the logic in this file should be kept in sync with the Java +# MarkNewlinesVisitor, since that visitor is responsible for marking the +# newlines for JRuby/TruffleRuby. +# +# This file is autoloaded only when `mark_newlines!` is called, so the +# re-opening of the various nodes in this file will only be performed in +# that case. We do that to avoid storing the extra `@newline` instance +# variable on every node if we don't need it. +# +# source://prism//lib/prism/parse_result/newlines.rb#25 +class Prism::ParseResult::Newlines < ::Prism::Visitor + # Create a new Newlines visitor with the given newline offsets. # - # @return [RedoNode] a new instance of RedoNode + # @return [Newlines] a new instance of Newlines # - # source://prism//lib/prism/node.rb#16624 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/parse_result/newlines.rb#27 + def initialize(lines); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Permit block/lambda nodes to mark newlines within themselves. # - # source://prism//lib/prism/node.rb#16699 - def ===(other); end + # source://prism//lib/prism/parse_result/newlines.rb#33 + def visit_block_node(node); end - # def accept: (Visitor visitor) -> void + # Mark if/unless nodes as newlines. # - # source://prism//lib/prism/node.rb#16631 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/parse_result/newlines.rb#47 + def visit_if_node(node); end - # def child_nodes: () -> Array[nil | Node] + # Permit block/lambda nodes to mark newlines within themselves. # - # source://prism//lib/prism/node.rb#16636 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/parse_result/newlines.rb#33 + def visit_lambda_node(node); end - # def comment_targets: () -> Array[Node | Location] + # Permit statements lists to mark newlines within themselves. # - # source://prism//lib/prism/node.rb#16646 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/parse_result/newlines.rb#55 + def visit_statements_node(node); end - # def compact_child_nodes: () -> Array[Node] + # Mark if/unless nodes as newlines. # - # source://prism//lib/prism/node.rb#16641 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/parse_result/newlines.rb#47 + def visit_unless_node(node); end +end - # def copy: (?location: Location) -> RedoNode +# This represents a warning that was encountered during parsing. +# +# source://prism//lib/prism/parse_result.rb#643 +class Prism::ParseWarning + # Create a new warning object with the given message and location. # - # source://prism//lib/prism/node.rb#16651 - sig { params(location: Prism::Location).returns(Prism::RedoNode) } - def copy(location: T.unsafe(nil)); end - - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # @return [ParseWarning] a new instance of ParseWarning # - # source://prism//lib/prism/node.rb#16636 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/parse_result.rb#658 + sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } + def initialize(type, message, location, level); end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # Implement the hash pattern matching interface for ParseWarning. # - # source://prism//lib/prism/node.rb#16659 + # source://prism//lib/prism/parse_result.rb#666 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Returns a string representation of this warning. + # + # source://prism//lib/prism/parse_result.rb#671 + sig { returns(String) } + def inspect; end - # def inspect(NodeInspector inspector) -> String + # The level of this warning. # - # source://prism//lib/prism/node.rb#16664 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#655 + sig { returns(Symbol) } + def level; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # A Location object representing the location of this warning in the source. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/parse_result.rb#652 + sig { returns(Prism::Location) } + def location; end + + # The message associated with this warning. # - # def type: () -> Symbol + # source://prism//lib/prism/parse_result.rb#649 + sig { returns(String) } + def message; end + + # The type of warning. This is an _internal_ symbol that is used for + # communicating with translation layers. It is not meant to be public API. # - # source://prism//lib/prism/node.rb#16683 - sig { override.returns(Symbol) } + # source://prism//lib/prism/parse_result.rb#646 + sig { returns(Symbol) } def type; end - - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16693 - def type; end - end end -# The Reflection module provides the ability to reflect on the structure of -# the syntax tree itself, as opposed to looking at a single syntax tree. This -# is useful in metaprogramming contexts. +# A pattern is an object that wraps a Ruby pattern matching expression. The +# expression would normally be passed to an `in` clause within a `case` +# expression or a rightward assignment expression. For example, in the +# following snippet: # -# source://prism//lib/prism/reflection.rb#13 -module Prism::Reflection - class << self - # Returns the fields for the given node. - # - # source://prism//lib/prism/reflection.rb#104 - sig { params(node: T.class_of(Prism::Node)).returns(T::Array[Prism::Reflection::Field]) } - def fields_for(node); end - end -end - -# A constant field represents a constant value on a node. Effectively, it -# represents an identifier found within the source. It resolves to a symbol -# in Ruby. +# case node +# in ConstantPathNode[ConstantReadNode[name: :Prism], ConstantReadNode[name: :Pattern]] +# end # -# source://prism//lib/prism/reflection.rb#45 -class Prism::Reflection::ConstantField < ::Prism::Reflection::Field; end - -# A constant list field represents a list of constant values on a node. It -# resolves to an array of symbols in Ruby. +# the pattern is the ConstantPathNode[...] expression. # -# source://prism//lib/prism/reflection.rb#55 -class Prism::Reflection::ConstantListField < ::Prism::Reflection::Field; end - -# A field represents a single piece of data on a node. It is the base class -# for all other field types. +# The pattern gets compiled into an object that responds to #call by running +# the #compile method. This method itself will run back through Prism to +# parse the expression into a tree, then walk the tree to generate the +# necessary callable objects. For example, if you wanted to compile the +# expression above into a callable, you would: # -# source://prism//lib/prism/reflection.rb#16 -class Prism::Reflection::Field - # Initializes the field with the given name. - # - # @return [Field] a new instance of Field +# callable = Prism::Pattern.new("ConstantPathNode[ConstantReadNode[name: :Prism], ConstantReadNode[name: :Pattern]]").compile +# callable.call(node) +# +# The callable object returned by #compile is guaranteed to respond to #call +# with a single argument, which is the node to match against. It also is +# guaranteed to respond to #===, which means it itself can be used in a `case` +# expression, as in: +# +# case node +# when callable +# end +# +# If the query given to the initializer cannot be compiled into a valid +# matcher (either because of a syntax error or because it is using syntax we +# do not yet support) then a Prism::Pattern::CompilationError will be +# raised. +# +# source://prism//lib/prism/pattern.rb#37 +class Prism::Pattern + # Create a new pattern with the given query. The query should be a string + # containing a Ruby pattern matching expression. # - # source://prism//lib/prism/reflection.rb#21 - sig { params(name: Symbol).void } - def initialize(name); end - - # The name of the field. + # @return [Pattern] a new instance of Pattern # - # source://prism//lib/prism/reflection.rb#18 - sig { returns(Symbol) } - def name; end -end + # source://prism//lib/prism/pattern.rb#63 + def initialize(query); end -# A flags field represents a bitset of flags on a node. It resolves to an -# integer in Ruby. Note that the flags cannot be accessed directly on the -# node because the integer is kept private. Instead, the various flags in -# the bitset should be accessed through their query methods. -# -# source://prism//lib/prism/reflection.rb#92 -class Prism::Reflection::FlagsField < ::Prism::Reflection::Field - # Initializes the flags field with the given name and flags. + # Compile the query into a callable object that can be used to match against + # nodes. # - # @return [FlagsField] a new instance of FlagsField + # @raise [CompilationError] # - # source://prism//lib/prism/reflection.rb#97 - sig { params(name: Symbol, flags: T::Array[Symbol]).void } - def initialize(name, flags); end + # source://prism//lib/prism/pattern.rb#70 + def compile; end - # The names of the flags in the bitset. + # The query that this pattern was initialized with. # - # source://prism//lib/prism/reflection.rb#94 - sig { returns(T::Array[Symbol]) } - def flags; end -end - -# A float field represents a double-precision floating point value. It is -# used exclusively to represent the value of a floating point literal. It -# resolves to a Float in Ruby. -# -# source://prism//lib/prism/reflection.rb#85 -class Prism::Reflection::FloatField < ::Prism::Reflection::Field; end - -# An integer field represents an integer value. It is used to represent the -# value of an integer literal, the depth of local variables, and the number -# of a numbered reference. It resolves to an Integer in Ruby. -# -# source://prism//lib/prism/reflection.rb#79 -class Prism::Reflection::IntegerField < ::Prism::Reflection::Field; end - -# A location field represents the location of some part of the node in the -# source code. For example, the location of a keyword or an operator. It -# resolves to a Prism::Location in Ruby. -# -# source://prism//lib/prism/reflection.rb#67 -class Prism::Reflection::LocationField < ::Prism::Reflection::Field; end - -# A node field represents a single child node in the syntax tree. It -# resolves to a Prism::Node in Ruby. -# -# source://prism//lib/prism/reflection.rb#28 -class Prism::Reflection::NodeField < ::Prism::Reflection::Field; end + # source://prism//lib/prism/pattern.rb#59 + def query; end -# A node list field represents a list of child nodes in the syntax tree. It -# resolves to an array of Prism::Node instances in Ruby. -# -# source://prism//lib/prism/reflection.rb#39 -class Prism::Reflection::NodeListField < ::Prism::Reflection::Field; end + # Scan the given node and all of its children for nodes that match the + # pattern. If a block is given, it will be called with each node that + # matches the pattern. If no block is given, an enumerator will be returned + # that will yield each node that matches the pattern. + # + # source://prism//lib/prism/pattern.rb#86 + def scan(root); end -# An optional constant field represents a constant value on a node that may -# or may not be present. It resolves to either a symbol or nil in Ruby. -# -# source://prism//lib/prism/reflection.rb#50 -class Prism::Reflection::OptionalConstantField < ::Prism::Reflection::Field; end + private -# An optional location field represents the location of some part of the -# node in the source code that may or may not be present. It resolves to -# either a Prism::Location or nil in Ruby. -# -# source://prism//lib/prism/reflection.rb#73 -class Prism::Reflection::OptionalLocationField < ::Prism::Reflection::Field; end + # Shortcut for combining two procs into one that returns true if both return + # true. + # + # source://prism//lib/prism/pattern.rb#102 + def combine_and(left, right); end -# An optional node field represents a single child node in the syntax tree -# that may or may not be present. It resolves to either a Prism::Node or nil -# in Ruby. -# -# source://prism//lib/prism/reflection.rb#34 -class Prism::Reflection::OptionalNodeField < ::Prism::Reflection::Field; end + # Shortcut for combining two procs into one that returns true if either + # returns true. + # + # source://prism//lib/prism/pattern.rb#108 + def combine_or(left, right); end -# A string field represents a string value on a node. It almost always -# represents the unescaped value of a string-like literal. It resolves to a -# string in Ruby. -# -# source://prism//lib/prism/reflection.rb#61 -class Prism::Reflection::StringField < ::Prism::Reflection::Field; end + # in foo | bar + # + # source://prism//lib/prism/pattern.rb#143 + def compile_alternation_pattern_node(node); end -# Flags for regular expression and match last line nodes. -# -# source://prism//lib/prism/node.rb#20421 -module Prism::RegularExpressionFlags; end + # in [foo, bar, baz] + # + # source://prism//lib/prism/pattern.rb#118 + def compile_array_pattern_node(node); end -# n - forces the ASCII-8BIT encoding -# -# source://prism//lib/prism/node.rb#20438 -Prism::RegularExpressionFlags::ASCII_8BIT = T.let(T.unsafe(nil), Integer) + # Compile a name associated with a constant. + # + # source://prism//lib/prism/pattern.rb#168 + def compile_constant_name(node, name); end -# e - forces the EUC-JP encoding -# -# source://prism//lib/prism/node.rb#20435 -Prism::RegularExpressionFlags::EUC_JP = T.let(T.unsafe(nil), Integer) + # in Prism::ConstantReadNode + # + # source://prism//lib/prism/pattern.rb#148 + def compile_constant_path_node(node); end -# x - ignores whitespace and allows comments in regular expressions -# -# source://prism//lib/prism/node.rb#20426 -Prism::RegularExpressionFlags::EXTENDED = T.let(T.unsafe(nil), Integer) + # in ConstantReadNode + # in String + # + # source://prism//lib/prism/pattern.rb#163 + def compile_constant_read_node(node); end -# internal bytes forced the encoding to binary -# -# source://prism//lib/prism/node.rb#20450 -Prism::RegularExpressionFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) + # Raise an error because the given node is not supported. + # + # @raise [CompilationError] + # + # source://prism//lib/prism/pattern.rb#113 + def compile_error(node); end -# internal bytes forced the encoding to US-ASCII -# -# source://prism//lib/prism/node.rb#20453 -Prism::RegularExpressionFlags::FORCED_US_ASCII_ENCODING = T.let(T.unsafe(nil), Integer) + # in InstanceVariableReadNode[name: Symbol] + # in { name: Symbol } + # + # source://prism//lib/prism/pattern.rb#184 + def compile_hash_pattern_node(node); end -# internal bytes forced the encoding to UTF-8 -# -# source://prism//lib/prism/node.rb#20447 -Prism::RegularExpressionFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) + # in nil + # + # source://prism//lib/prism/pattern.rb#214 + def compile_nil_node(node); end -# i - ignores the case of characters when matching -# -# source://prism//lib/prism/node.rb#20423 -Prism::RegularExpressionFlags::IGNORE_CASE = T.let(T.unsafe(nil), Integer) + # Compile any kind of node. Dispatch out to the individual compilation + # methods based on the type of node. + # + # source://prism//lib/prism/pattern.rb#243 + def compile_node(node); end -# m - allows $ to match the end of lines within strings -# -# source://prism//lib/prism/node.rb#20429 -Prism::RegularExpressionFlags::MULTI_LINE = T.let(T.unsafe(nil), Integer) + # in /foo/ + # + # source://prism//lib/prism/pattern.rb#219 + def compile_regular_expression_node(node); end -# o - only interpolates values into the regular expression once -# -# source://prism//lib/prism/node.rb#20432 -Prism::RegularExpressionFlags::ONCE = T.let(T.unsafe(nil), Integer) + # in "" + # in "foo" + # + # source://prism//lib/prism/pattern.rb#227 + def compile_string_node(node); end -# u - forces the UTF-8 encoding -# -# source://prism//lib/prism/node.rb#20444 -Prism::RegularExpressionFlags::UTF_8 = T.let(T.unsafe(nil), Integer) + # in :+ + # in :foo + # + # source://prism//lib/prism/pattern.rb#235 + def compile_symbol_node(node); end +end -# s - forces the Windows-31J encoding +# Raised when the query given to a pattern is either invalid Ruby syntax or +# is using syntax that we don't yet support. # -# source://prism//lib/prism/node.rb#20441 -Prism::RegularExpressionFlags::WINDOWS_31J = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/pattern.rb#40 +class Prism::Pattern::CompilationError < ::StandardError + # Create a new CompilationError with the given representation of the node + # that caused the error. + # + # @return [CompilationError] a new instance of CompilationError + # + # source://prism//lib/prism/pattern.rb#43 + def initialize(repr); end +end -# Represents a regular expression literal with no interpolation. +# Represents the use of the `^` operator for pinning an expression in a pattern matching expression. # -# /foo/i -# ^^^^^^ +# foo in ^(bar) +# ^^^^^^ # -# source://prism//lib/prism/node.rb#16708 -class Prism::RegularExpressionNode < ::Prism::Node - include ::Prism::RegularExpressionOptions - - # def initialize: (Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped, Location location) -> void +# source://prism//lib/prism/node.rb#14383 +class Prism::PinnedExpressionNode < ::Prism::Node + # Initialize a new PinnedExpressionNode node. # - # @return [RegularExpressionNode] a new instance of RegularExpressionNode + # @return [PinnedExpressionNode] a new instance of PinnedExpressionNode # - # source://prism//lib/prism/node.rb#16710 + # source://prism//lib/prism/node.rb#14385 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - content_loc: Prism::Location, - closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location + expression: Prism::Node, + operator_loc: Prism::Location, + lparen_loc: Prism::Location, + rparen_loc: Prism::Location ).void end - def initialize(source, flags, opening_loc, content_loc, closing_loc, unescaped, location); end + def initialize(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#16894 + # source://prism//lib/prism/node.rb#14503 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#16722 + # source://prism//lib/prism/node.rb#14397 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # def ascii_8bit?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#16808 - sig { returns(T::Boolean) } - def ascii_8bit?; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16727 + # source://prism//lib/prism/node.rb#14402 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#16848 - sig { returns(String) } - def closing; end - - # attr_reader closing_loc: Location - # - # source://prism//lib/prism/node.rb#16773 - sig { returns(Prism::Location) } - def closing_loc; end - - # def comment_targets: () -> Array[Node | Location] - # - # source://prism//lib/prism/node.rb#16737 + # source://prism//lib/prism/node.rb#14412 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#16732 + # source://prism//lib/prism/node.rb#14407 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def content: () -> String - # - # source://prism//lib/prism/node.rb#16843 - sig { returns(String) } - def content; end - - # attr_reader content_loc: Location - # - # source://prism//lib/prism/node.rb#16766 - sig { returns(Prism::Location) } - def content_loc; end - - # def copy: (?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String, ?location: Location) -> RegularExpressionNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode # - # source://prism//lib/prism/node.rb#16742 + # source://prism//lib/prism/node.rb#14417 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: Prism::Location, - content_loc: Prism::Location, - closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location - ).returns(Prism::RegularExpressionNode) + expression: Prism::Node, + operator_loc: Prism::Location, + lparen_loc: Prism::Location, + rparen_loc: Prism::Location + ).returns(Prism::PinnedExpressionNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16727 + # source://prism//lib/prism/node.rb#14402 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location } # - # source://prism//lib/prism/node.rb#16750 + # source://prism//lib/prism/node.rb#14425 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def euc_jp?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#16803 - sig { returns(T::Boolean) } - def euc_jp?; end - - # def extended?: () -> bool - # - # @return [Boolean] + # attr_reader expression: Prism::node # - # source://prism//lib/prism/node.rb#16788 - sig { returns(T::Boolean) } - def extended?; end + # source://prism//lib/prism/node.rb#14430 + sig { returns(Prism::Node) } + def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def forced_binary_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#16828 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end - - # def forced_us_ascii_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#16833 - sig { returns(T::Boolean) } - def forced_us_ascii_encoding?; end - - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] + # def inspect -> String # - # source://prism//lib/prism/node.rb#16823 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end + # source://prism//lib/prism/node.rb#14487 + sig { override.returns(String) } + def inspect; end - # def ignore_case?: () -> bool - # - # @return [Boolean] + # def lparen: () -> String # - # source://prism//lib/prism/node.rb#16783 - sig { returns(T::Boolean) } - def ignore_case?; end + # source://prism//lib/prism/node.rb#14477 + sig { returns(String) } + def lparen; end - # def inspect(NodeInspector inspector) -> String + # attr_reader lparen_loc: Location # - # source://prism//lib/prism/node.rb#16853 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14446 + sig { returns(Prism::Location) } + def lparen_loc; end - # def multi_line?: () -> bool - # - # @return [Boolean] + # def operator: () -> String # - # source://prism//lib/prism/node.rb#16793 - sig { returns(T::Boolean) } - def multi_line?; end + # source://prism//lib/prism/node.rb#14472 + sig { returns(String) } + def operator; end - # def once?: () -> bool - # - # @return [Boolean] + # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#16798 - sig { returns(T::Boolean) } - def once?; end + # source://prism//lib/prism/node.rb#14433 + sig { returns(Prism::Location) } + def operator_loc; end - # def opening: () -> String + # def rparen: () -> String # - # source://prism//lib/prism/node.rb#16838 + # source://prism//lib/prism/node.rb#14482 sig { returns(String) } - def opening; end + def rparen; end - # attr_reader opening_loc: Location + # attr_reader rparen_loc: Location # - # source://prism//lib/prism/node.rb#16759 + # source://prism//lib/prism/node.rb#14459 sig { returns(Prism::Location) } - def opening_loc; end - - sig { returns(Integer) } - def options; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16878 - sig { override.returns(Symbol) } - def type; end + def rparen_loc; end - # attr_reader unescaped: String + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#16780 - sig { returns(String) } - def unescaped; end + # source://prism//lib/prism/node.rb#14454 + def save_lparen_loc(repository); end - # def utf_8?: () -> bool - # - # @return [Boolean] + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#16818 - sig { returns(T::Boolean) } - def utf_8?; end + # source://prism//lib/prism/node.rb#14441 + def save_operator_loc(repository); end - # def windows_31j?: () -> bool - # - # @return [Boolean] + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#16813 - sig { returns(T::Boolean) } - def windows_31j?; end - - protected + # source://prism//lib/prism/node.rb#14467 + def save_rparen_loc(repository); end - # protected attr_reader flags: Integer + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#16755 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#14492 + sig { override.returns(Symbol) } + def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#16888 + # source://prism//lib/prism/node.rb#14497 def type; end end end -# source://prism//lib/prism/node_ext.rb#6 -module Prism::RegularExpressionOptions - # Returns a numeric value that represents the flags that were used to create - # the regular expression. - # - # source://prism//lib/prism/node_ext.rb#9 - def options; end -end - -# Represents a required keyword parameter to a method, block, or lambda definition. +# Represents the use of the `^` operator for pinning a variable in a pattern matching expression. # -# def a(b: ) -# ^^ -# end +# foo in ^bar +# ^^^^ # -# source://prism//lib/prism/node.rb#16909 -class Prism::RequiredKeywordParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol name, Location name_loc, Location location) -> void +# source://prism//lib/prism/node.rb#14516 +class Prism::PinnedVariableNode < ::Prism::Node + # Initialize a new PinnedVariableNode node. # - # @return [RequiredKeywordParameterNode] a new instance of RequiredKeywordParameterNode + # @return [PinnedVariableNode] a new instance of PinnedVariableNode # - # source://prism//lib/prism/node.rb#16911 + # source://prism//lib/prism/node.rb#14518 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - name: Symbol, - name_loc: Prism::Location, - location: Prism::Location + variable: T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode), + operator_loc: Prism::Location ).void end - def initialize(source, flags, name, name_loc, location); end + def initialize(source, node_id, location, flags, variable, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17012 + # source://prism//lib/prism/node.rb#14598 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#16921 + # source://prism//lib/prism/node.rb#14528 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16926 + # source://prism//lib/prism/node.rb#14533 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#16936 + # source://prism//lib/prism/node.rb#14543 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#16931 + # source://prism//lib/prism/node.rb#14538 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol, ?name_loc: Location, ?location: Location) -> RequiredKeywordParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode, ?operator_loc: Location) -> PinnedVariableNode # - # source://prism//lib/prism/node.rb#16941 + # source://prism//lib/prism/node.rb#14548 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - name: Symbol, - name_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::RequiredKeywordParameterNode) + variable: T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode), + operator_loc: Prism::Location + ).returns(Prism::PinnedVariableNode) end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), variable: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#16926 + # source://prism//lib/prism/node.rb#14533 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol, name_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode, operator_loc: Location } # - # source://prism//lib/prism/node.rb#16949 + # source://prism//lib/prism/node.rb#14556 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#16973 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14582 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # def operator: () -> String # - # source://prism//lib/prism/node.rb#16958 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/node.rb#14577 + sig { returns(String) } + def operator; end - # attr_reader name_loc: Location + # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#16961 + # source://prism//lib/prism/node.rb#14564 sig { returns(Prism::Location) } - def name_loc; end + def operator_loc; end - # def repeated_parameter?: () -> bool - # - # @return [Boolean] + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#16968 - sig { returns(T::Boolean) } - def repeated_parameter?; end + # source://prism//lib/prism/node.rb#14572 + def save_operator_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#16996 + # source://prism//lib/prism/node.rb#14587 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer + # attr_reader variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode # - # source://prism//lib/prism/node.rb#16954 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#14561 + sig do + returns(T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode)) + end + def variable; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17006 + # source://prism//lib/prism/node.rb#14592 def type; end end end -# Represents a required parameter to a method, block, or lambda definition. +# Represents the use of the `END` keyword. # -# def a(b) -# ^ -# end +# END { foo } +# ^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#17025 -class Prism::RequiredParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol name, Location location) -> void +# source://prism//lib/prism/node.rb#14609 +class Prism::PostExecutionNode < ::Prism::Node + # Initialize a new PostExecutionNode node. # - # @return [RequiredParameterNode] a new instance of RequiredParameterNode + # @return [PostExecutionNode] a new instance of PostExecutionNode # - # source://prism//lib/prism/node.rb#17027 - sig { params(source: Prism::Source, flags: Integer, name: Symbol, location: Prism::Location).void } - def initialize(source, flags, name, location); end + # source://prism//lib/prism/node.rb#14611 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17119 + # source://prism//lib/prism/node.rb#14731 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17036 + # source://prism//lib/prism/node.rb#14623 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17041 + # source://prism//lib/prism/node.rb#14628 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#14710 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#14687 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17051 + # source://prism//lib/prism/node.rb#14640 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17046 + # source://prism//lib/prism/node.rb#14633 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol, ?location: Location) -> RequiredParameterNode - # - # source://prism//lib/prism/node.rb#17056 - sig { params(flags: Integer, name: Symbol, location: Prism::Location).returns(Prism::RequiredParameterNode) } - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), location: T.unsafe(nil)); end - - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode # - # source://prism//lib/prism/node.rb#17041 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/node.rb#14645 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PostExecutionNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol, location: Location } + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#14628 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end + + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location } # - # source://prism//lib/prism/node.rb#17064 + # source://prism//lib/prism/node.rb#14653 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#17081 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14715 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol + # def keyword: () -> String # - # source://prism//lib/prism/node.rb#17073 - sig { returns(Symbol) } - def name; end + # source://prism//lib/prism/node.rb#14700 + sig { returns(String) } + def keyword; end - # def repeated_parameter?: () -> bool + # attr_reader keyword_loc: Location # - # @return [Boolean] + # source://prism//lib/prism/node.rb#14661 + sig { returns(Prism::Location) } + def keyword_loc; end + + # def opening: () -> String # - # source://prism//lib/prism/node.rb#17076 - sig { returns(T::Boolean) } - def repeated_parameter?; end + # source://prism//lib/prism/node.rb#14705 + sig { returns(String) } + def opening; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # attr_reader opening_loc: Location # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#14674 + sig { returns(Prism::Location) } + def opening_loc; end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#14695 + def save_closing_loc(repository); end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#14669 + def save_keyword_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#17103 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#14682 + def save_opening_loc(repository); end - protected + # attr_reader statements: StatementsNode? + # + # source://prism//lib/prism/node.rb#14658 + sig { returns(T.nilable(Prism::StatementsNode)) } + def statements; end - # protected attr_reader flags: Integer + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#17069 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#14720 + sig { override.returns(Symbol) } + def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#17113 + # source://prism//lib/prism/node.rb#14725 def type; end end end -# Represents an expression modified with a rescue. +# Represents the use of the `BEGIN` keyword. # -# foo rescue nil -# ^^^^^^^^^^^^^^ +# BEGIN { foo } +# ^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#17130 -class Prism::RescueModifierNode < ::Prism::Node - # def initialize: (Prism::node expression, Location keyword_loc, Prism::node rescue_expression, Location location) -> void +# source://prism//lib/prism/node.rb#14744 +class Prism::PreExecutionNode < ::Prism::Node + # Initialize a new PreExecutionNode node. # - # @return [RescueModifierNode] a new instance of RescueModifierNode + # @return [PreExecutionNode] a new instance of PreExecutionNode # - # source://prism//lib/prism/node.rb#17132 + # source://prism//lib/prism/node.rb#14746 sig do params( source: Prism::Source, - expression: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), keyword_loc: Prism::Location, - rescue_expression: Prism::Node, - location: Prism::Location + opening_loc: Prism::Location, + closing_loc: Prism::Location ).void end - def initialize(source, expression, keyword_loc, rescue_expression, location); end + def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17237 + # source://prism//lib/prism/node.rb#14866 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17142 + # source://prism//lib/prism/node.rb#14758 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17151 + # source://prism//lib/prism/node.rb#14763 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#14845 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#14822 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17161 + # source://prism//lib/prism/node.rb#14775 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17156 + # source://prism//lib/prism/node.rb#14768 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node, ?location: Location) -> RescueModifierNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode # - # source://prism//lib/prism/node.rb#17166 + # source://prism//lib/prism/node.rb#14780 sig do params( - expression: Prism::Node, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), keyword_loc: Prism::Location, - rescue_expression: Prism::Node, - location: Prism::Location - ).returns(Prism::RescueModifierNode) + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PreExecutionNode) end - def copy(expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17151 + # source://prism//lib/prism/node.rb#14763 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { expression: Prism::node, keyword_loc: Location, rescue_expression: Prism::node, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location } # - # source://prism//lib/prism/node.rb#17174 + # source://prism//lib/prism/node.rb#14788 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader expression: Prism::node - # - # source://prism//lib/prism/node.rb#17179 - sig { returns(Prism::Node) } - def expression; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#17197 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#14850 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#17192 + # source://prism//lib/prism/node.rb#14835 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#17182 + # source://prism//lib/prism/node.rb#14796 sig { returns(Prism::Location) } def keyword_loc; end - # attr_reader rescue_expression: Prism::node + # def opening: () -> String # - # source://prism//lib/prism/node.rb#17189 - sig { returns(Prism::Node) } - def rescue_expression; end + # source://prism//lib/prism/node.rb#14840 + sig { returns(String) } + def opening; end + + # attr_reader opening_loc: Location + # + # source://prism//lib/prism/node.rb#14809 + sig { returns(Prism::Location) } + def opening_loc; end - # source://prism//lib/prism/node.rb#17146 - def set_newline_flag(newline_marked); end + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#14830 + def save_closing_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#14804 + def save_keyword_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#14817 + def save_opening_loc(repository); end + + # attr_reader statements: StatementsNode? # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#14793 + sig { returns(T.nilable(Prism::StatementsNode)) } + def statements; end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#17221 + # source://prism//lib/prism/node.rb#14855 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#17231 + # source://prism//lib/prism/node.rb#14860 def type; end end end -# Represents a rescue statement. -# -# begin -# rescue Foo, *splat, Bar => ex -# foo -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# end -# -# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field. +# The top level node of any parse tree. # -# source://prism//lib/prism/node.rb#17254 -class Prism::RescueNode < ::Prism::Node - # def initialize: (Location keyword_loc, Array[Prism::node] exceptions, Location? operator_loc, Prism::node? reference, StatementsNode? statements, RescueNode? consequent, Location location) -> void +# source://prism//lib/prism/node.rb#14876 +class Prism::ProgramNode < ::Prism::Node + # Initialize a new ProgramNode node. # - # @return [RescueNode] a new instance of RescueNode + # @return [ProgramNode] a new instance of ProgramNode # - # source://prism//lib/prism/node.rb#17256 + # source://prism//lib/prism/node.rb#14878 sig do params( source: Prism::Source, - keyword_loc: Prism::Location, - exceptions: T::Array[Prism::Node], - operator_loc: T.nilable(Prism::Location), - reference: T.nilable(Prism::Node), - statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::RescueNode), - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + statements: Prism::StatementsNode ).void end - def initialize(source, keyword_loc, exceptions, operator_loc, reference, statements, consequent, location); end + def initialize(source, node_id, location, flags, locals, statements); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17405 + # source://prism//lib/prism/node.rb#14943 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17269 + # source://prism//lib/prism/node.rb#14888 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17274 + # source://prism//lib/prism/node.rb#14893 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17289 + # source://prism//lib/prism/node.rb#14903 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17279 + # source://prism//lib/prism/node.rb#14898 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # attr_reader consequent: RescueNode? - # - # source://prism//lib/prism/node.rb#17336 - sig { returns(T.nilable(Prism::RescueNode)) } - def consequent; end - - # def copy: (?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: Prism::node?, ?statements: StatementsNode?, ?consequent: RescueNode?, ?location: Location) -> RescueNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode # - # source://prism//lib/prism/node.rb#17294 + # source://prism//lib/prism/node.rb#14908 sig do params( - keyword_loc: Prism::Location, - exceptions: T::Array[Prism::Node], - operator_loc: T.nilable(Prism::Location), - reference: T.nilable(Prism::Node), - statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::RescueNode), - location: Prism::Location - ).returns(Prism::RescueNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + statements: Prism::StatementsNode + ).returns(Prism::ProgramNode) end - def copy(keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), statements: T.unsafe(nil), consequent: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17274 + # source://prism//lib/prism/node.rb#14893 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, exceptions: Array[Prism::node], operator_loc: Location?, reference: Prism::node?, statements: StatementsNode?, consequent: RescueNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], statements: StatementsNode } # - # source://prism//lib/prism/node.rb#17302 + # source://prism//lib/prism/node.rb#14916 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader exceptions: Array[Prism::node] - # - # source://prism//lib/prism/node.rb#17314 - sig { returns(T::Array[Prism::Node]) } - def exceptions; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#17349 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def keyword: () -> String - # - # source://prism//lib/prism/node.rb#17339 - sig { returns(String) } - def keyword; end - - # attr_reader keyword_loc: Location - # - # source://prism//lib/prism/node.rb#17307 - sig { returns(Prism::Location) } - def keyword_loc; end - - # def operator: () -> String? - # - # source://prism//lib/prism/node.rb#17344 - sig { returns(T.nilable(String)) } - def operator; end - - # attr_reader operator_loc: Location? + # def inspect -> String # - # source://prism//lib/prism/node.rb#17317 - sig { returns(T.nilable(Prism::Location)) } - def operator_loc; end + # source://prism//lib/prism/node.rb#14927 + sig { override.returns(String) } + def inspect; end - # attr_reader reference: Prism::node? + # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/node.rb#17330 - sig { returns(T.nilable(Prism::Node)) } - def reference; end + # source://prism//lib/prism/node.rb#14921 + sig { returns(T::Array[Symbol]) } + def locals; end - # attr_reader statements: StatementsNode? + # attr_reader statements: StatementsNode # - # source://prism//lib/prism/node.rb#17333 - sig { returns(T.nilable(Prism::StatementsNode)) } + # source://prism//lib/prism/node.rb#14924 + sig { returns(Prism::StatementsNode) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#17389 + # source://prism//lib/prism/node.rb#14932 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17399 + # source://prism//lib/prism/node.rb#14937 def type; end end end -# Represents a rest parameter to a method, block, or lambda definition. +# Flags for range and flip-flop nodes. # -# def a(*b) -# ^^ -# end +# source://prism//lib/prism/node.rb#18555 +module Prism::RangeFlags; end + +# ... operator # -# source://prism//lib/prism/node.rb#17422 -class Prism::RestParameterNode < ::Prism::Node - # def initialize: (Integer flags, Symbol? name, Location? name_loc, Location operator_loc, Location location) -> void +# source://prism//lib/prism/node.rb#18557 +Prism::RangeFlags::EXCLUDE_END = T.let(T.unsafe(nil), Integer) + +# Represents the use of the `..` or `...` operators. +# +# 1..2 +# ^^^^ +# +# c if a =~ /left/ ... b =~ /right/ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#14958 +class Prism::RangeNode < ::Prism::Node + # Initialize a new RangeNode node. # - # @return [RestParameterNode] a new instance of RestParameterNode + # @return [RangeNode] a new instance of RangeNode # - # source://prism//lib/prism/node.rb#17424 + # source://prism//lib/prism/node.rb#14960 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - name: T.nilable(Symbol), - name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location + left: T.nilable(Prism::Node), + right: T.nilable(Prism::Node), + operator_loc: Prism::Location ).void end - def initialize(source, flags, name, name_loc, operator_loc, location); end + def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17549 + # source://prism//lib/prism/node.rb#15065 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17435 + # source://prism//lib/prism/node.rb#14971 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17440 + # source://prism//lib/prism/node.rb#14976 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17450 + # source://prism//lib/prism/node.rb#14989 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17445 + # source://prism//lib/prism/node.rb#14981 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location, ?location: Location) -> RestParameterNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode # - # source://prism//lib/prism/node.rb#17455 + # source://prism//lib/prism/node.rb#14994 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - name: T.nilable(Symbol), - name_loc: T.nilable(Prism::Location), - operator_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::RestParameterNode) + left: T.nilable(Prism::Node), + right: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::RangeNode) end - def copy(flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17440 + # source://prism//lib/prism/node.rb#14976 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, name: Symbol?, name_loc: Location?, operator_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node?, right: Prism::node?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#17463 + # source://prism//lib/prism/node.rb#15002 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # def exclude_end?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15007 + sig { returns(T::Boolean) } + def exclude_end?; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#17505 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15049 + sig { override.returns(String) } + def inspect; end - # attr_reader name: Symbol? + # The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # source://prism//lib/prism/node.rb#17472 - sig { returns(T.nilable(Symbol)) } - def name; end - - # attr_reader name_loc: Location? + # 1... + # ^ # - # source://prism//lib/prism/node.rb#17475 - sig { returns(T.nilable(Prism::Location)) } - def name_loc; end + # hello...goodbye + # ^^^^^ + # + # source://prism//lib/prism/node.rb#15018 + sig { returns(T.nilable(Prism::Node)) } + def left; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#17500 + # source://prism//lib/prism/node.rb#15044 sig { returns(String) } def operator; end - # attr_reader operator_loc: Location + # The location of the `..` or `...` operator. # - # source://prism//lib/prism/node.rb#17488 + # source://prism//lib/prism/node.rb#15031 sig { returns(Prism::Location) } def operator_loc; end - # def repeated_parameter?: () -> bool + # The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # - # @return [Boolean] + # ..5 + # ^ # - # source://prism//lib/prism/node.rb#17495 - sig { returns(T::Boolean) } - def repeated_parameter?; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # 1...foo + # ^^^ + # If neither right-hand or left-hand side was included, this will be a MissingNode. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#15028 + sig { returns(T.nilable(Prism::Node)) } + def right; end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#15039 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#17533 + # source://prism//lib/prism/node.rb#15054 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#17468 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#17543 + # source://prism//lib/prism/node.rb#15059 def type; end end end -# This represents the result of a call to ::parse or ::parse_file. It contains -# the requested structure, any comments that were encounters, and any errors -# that were encountered. +# Represents a rational number literal. # -# source://prism//lib/prism/parse_result.rb#443 -class Prism::Result - # Create a new result object with the given values. +# 1.0r +# ^^^^ +# +# source://prism//lib/prism/node.rb#15078 +class Prism::RationalNode < ::Prism::Node + # Initialize a new RationalNode node. # - # @return [Result] a new instance of Result + # @return [RationalNode] a new instance of RationalNode # - # source://prism//lib/prism/parse_result.rb#465 + # source://prism//lib/prism/node.rb#15080 sig do params( - comments: T::Array[Prism::Comment], - magic_comments: T::Array[Prism::MagicComment], - data_loc: T.nilable(Prism::Location), - errors: T::Array[Prism::ParseError], - warnings: T::Array[Prism::ParseWarning], - source: Prism::Source + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + numerator: Integer, + denominator: Integer ).void end - def initialize(comments, magic_comments, data_loc, errors, warnings, source); end + def initialize(source, node_id, location, flags, numerator, denominator); end - # The list of comments that were encountered during parsing. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result.rb#445 - sig { returns(T::Array[Prism::Comment]) } - def comments; end + # source://prism//lib/prism/node.rb#15169 + def ===(other); end - # An optional location that represents the location of the __END__ marker - # and the rest of the content of the file. This content is loaded into the - # DATA constant when the file being parsed is the main file being executed. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result.rb#453 - sig { returns(T.nilable(Prism::Location)) } - def data_loc; end + # source://prism//lib/prism/node.rb#15090 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Implement the hash pattern matching interface for Result. + # def binary?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15123 + sig { returns(T::Boolean) } + def binary?; end + + # def child_nodes: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#15095 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end + + # def comment_targets: () -> Array[Node | Location] + # + # source://prism//lib/prism/node.rb#15105 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end + + # def compact_child_nodes: () -> Array[Node] + # + # source://prism//lib/prism/node.rb#15100 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end + + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numerator: Integer, ?denominator: Integer) -> RationalNode + # + # source://prism//lib/prism/node.rb#15110 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + numerator: Integer, + denominator: Integer + ).returns(Prism::RationalNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numerator: T.unsafe(nil), denominator: T.unsafe(nil)); end + + # def decimal?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15128 + sig { returns(T::Boolean) } + def decimal?; end + + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] + # + # source://prism//lib/prism/node.rb#15095 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end + + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, numerator: Integer, denominator: Integer } # - # source://prism//lib/prism/parse_result.rb#475 + # source://prism//lib/prism/node.rb#15118 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # Returns the encoding of the source code that was parsed. + # The denominator of the rational number. # - # source://prism//lib/prism/parse_result.rb#480 - sig { returns(Encoding) } - def encoding; end - - # The list of errors that were generated during parsing. + # 1.5r # denominator 2 # - # source://prism//lib/prism/parse_result.rb#456 - sig { returns(T::Array[Prism::ParseError]) } - def errors; end + # source://prism//lib/prism/node.rb#15150 + sig { returns(Integer) } + def denominator; end - # Returns true if there were errors during parsing and false if there were - # not. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def hexadecimal?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#492 + # source://prism//lib/prism/node.rb#15138 sig { returns(T::Boolean) } - def failure?; end + def hexadecimal?; end - # The list of magic comments that were encountered during parsing. + # def inspect -> String # - # source://prism//lib/prism/parse_result.rb#448 - sig { returns(T::Array[Prism::MagicComment]) } - def magic_comments; end + # source://prism//lib/prism/node.rb#15153 + sig { override.returns(String) } + def inspect; end - # A Source instance that represents the source code that was parsed. + # The numerator of the rational number. # - # source://prism//lib/prism/parse_result.rb#462 - sig { returns(Prism::Source) } - def source; end + # 1.5r # numerator 3 + # + # source://prism//lib/prism/node.rb#15145 + sig { returns(Integer) } + def numerator; end - # Returns true if there were no errors during parsing and false if there - # were. + # Returns the value of the node as an IntegerNode or a FloatNode. This + # method is deprecated in favor of #value or #numerator/#denominator. + # + # source://prism//lib/prism/node_ext.rb#120 + def numeric; end + + # def octal?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#486 + # source://prism//lib/prism/node.rb#15133 sig { returns(T::Boolean) } - def success?; end + def octal?; end - # The list of warnings that were generated during parsing. + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/parse_result.rb#459 - sig { returns(T::Array[Prism::ParseWarning]) } - def warnings; end + # source://prism//lib/prism/node.rb#15158 + sig { override.returns(Symbol) } + def type; end + + # Returns the value of the node as a Ruby Rational. + # + # source://prism//lib/prism/node_ext.rb#114 + sig { returns(Rational) } + def value; end + + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#15163 + def type; end + end end -# Represents the use of the `retry` keyword. +# Represents the use of the `redo` keyword. # -# retry -# ^^^^^ +# redo +# ^^^^ # -# source://prism//lib/prism/node.rb#17562 -class Prism::RetryNode < ::Prism::Node - # def initialize: (Location location) -> void +# source://prism//lib/prism/node.rb#15181 +class Prism::RedoNode < ::Prism::Node + # Initialize a new RedoNode node. # - # @return [RetryNode] a new instance of RetryNode + # @return [RedoNode] a new instance of RedoNode # - # source://prism//lib/prism/node.rb#17564 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#15183 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17639 + # source://prism//lib/prism/node.rb#15240 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17571 + # source://prism//lib/prism/node.rb#15191 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17576 + # source://prism//lib/prism/node.rb#15196 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17586 + # source://prism//lib/prism/node.rb#15206 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17581 + # source://prism//lib/prism/node.rb#15201 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> RetryNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RedoNode # - # source://prism//lib/prism/node.rb#17591 - sig { params(location: Prism::Location).returns(Prism::RetryNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15211 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::RedoNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17576 + # source://prism//lib/prism/node.rb#15196 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#17599 + # source://prism//lib/prism/node.rb#15219 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#17604 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15224 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17623 + # source://prism//lib/prism/node.rb#15229 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17633 + # source://prism//lib/prism/node.rb#15234 def type; end end end -# Represents the use of the `return` keyword. -# -# return 1 -# ^^^^^^^^ +# The Reflection module provides the ability to reflect on the structure of +# the syntax tree itself, as opposed to looking at a single syntax tree. This +# is useful in metaprogramming contexts. # -# source://prism//lib/prism/node.rb#17648 -class Prism::ReturnNode < ::Prism::Node - # def initialize: (Location keyword_loc, ArgumentsNode? arguments, Location location) -> void - # - # @return [ReturnNode] a new instance of ReturnNode - # - # source://prism//lib/prism/node.rb#17650 - sig do - params( - source: Prism::Source, - keyword_loc: Prism::Location, - arguments: T.nilable(Prism::ArgumentsNode), - location: Prism::Location - ).void - end - def initialize(source, keyword_loc, arguments, location); end - +# source://prism//lib/prism/reflection.rb#13 +module Prism::Reflection + class << self + # Returns the fields for the given node. + # + # source://prism//lib/prism/reflection.rb#104 + sig { params(node: T.class_of(Prism::Node)).returns(T::Array[Prism::Reflection::Field]) } + def fields_for(node); end + end +end + +# A constant field represents a constant value on a node. Effectively, it +# represents an identifier found within the source. It resolves to a symbol +# in Ruby. +# +# source://prism//lib/prism/reflection.rb#45 +class Prism::Reflection::ConstantField < ::Prism::Reflection::Field; end + +# A constant list field represents a list of constant values on a node. It +# resolves to an array of symbols in Ruby. +# +# source://prism//lib/prism/reflection.rb#55 +class Prism::Reflection::ConstantListField < ::Prism::Reflection::Field; end + +# A field represents a single piece of data on a node. It is the base class +# for all other field types. +# +# source://prism//lib/prism/reflection.rb#16 +class Prism::Reflection::Field + # Initializes the field with the given name. + # + # @return [Field] a new instance of Field + # + # source://prism//lib/prism/reflection.rb#21 + sig { params(name: Symbol).void } + def initialize(name); end + + # The name of the field. + # + # source://prism//lib/prism/reflection.rb#18 + sig { returns(Symbol) } + def name; end +end + +# A flags field represents a bitset of flags on a node. It resolves to an +# integer in Ruby. Note that the flags cannot be accessed directly on the +# node because the integer is kept private. Instead, the various flags in +# the bitset should be accessed through their query methods. +# +# source://prism//lib/prism/reflection.rb#92 +class Prism::Reflection::FlagsField < ::Prism::Reflection::Field + # Initializes the flags field with the given name and flags. + # + # @return [FlagsField] a new instance of FlagsField + # + # source://prism//lib/prism/reflection.rb#97 + sig { params(name: Symbol, flags: T::Array[Symbol]).void } + def initialize(name, flags); end + + # The names of the flags in the bitset. + # + # source://prism//lib/prism/reflection.rb#94 + sig { returns(T::Array[Symbol]) } + def flags; end +end + +# A float field represents a double-precision floating point value. It is +# used exclusively to represent the value of a floating point literal. It +# resolves to a Float in Ruby. +# +# source://prism//lib/prism/reflection.rb#85 +class Prism::Reflection::FloatField < ::Prism::Reflection::Field; end + +# An integer field represents an integer value. It is used to represent the +# value of an integer literal, the depth of local variables, and the number +# of a numbered reference. It resolves to an Integer in Ruby. +# +# source://prism//lib/prism/reflection.rb#79 +class Prism::Reflection::IntegerField < ::Prism::Reflection::Field; end + +# A location field represents the location of some part of the node in the +# source code. For example, the location of a keyword or an operator. It +# resolves to a Prism::Location in Ruby. +# +# source://prism//lib/prism/reflection.rb#67 +class Prism::Reflection::LocationField < ::Prism::Reflection::Field; end + +# A node field represents a single child node in the syntax tree. It +# resolves to a Prism::Node in Ruby. +# +# source://prism//lib/prism/reflection.rb#28 +class Prism::Reflection::NodeField < ::Prism::Reflection::Field; end + +# A node list field represents a list of child nodes in the syntax tree. It +# resolves to an array of Prism::Node instances in Ruby. +# +# source://prism//lib/prism/reflection.rb#39 +class Prism::Reflection::NodeListField < ::Prism::Reflection::Field; end + +# An optional constant field represents a constant value on a node that may +# or may not be present. It resolves to either a symbol or nil in Ruby. +# +# source://prism//lib/prism/reflection.rb#50 +class Prism::Reflection::OptionalConstantField < ::Prism::Reflection::Field; end + +# An optional location field represents the location of some part of the +# node in the source code that may or may not be present. It resolves to +# either a Prism::Location or nil in Ruby. +# +# source://prism//lib/prism/reflection.rb#73 +class Prism::Reflection::OptionalLocationField < ::Prism::Reflection::Field; end + +# An optional node field represents a single child node in the syntax tree +# that may or may not be present. It resolves to either a Prism::Node or nil +# in Ruby. +# +# source://prism//lib/prism/reflection.rb#34 +class Prism::Reflection::OptionalNodeField < ::Prism::Reflection::Field; end + +# A string field represents a string value on a node. It almost always +# represents the unescaped value of a string-like literal. It resolves to a +# string in Ruby. +# +# source://prism//lib/prism/reflection.rb#61 +class Prism::Reflection::StringField < ::Prism::Reflection::Field; end + +# Flags for regular expression and match last line nodes. +# +# source://prism//lib/prism/node.rb#18561 +module Prism::RegularExpressionFlags; end + +# n - forces the ASCII-8BIT encoding +# +# source://prism//lib/prism/node.rb#18578 +Prism::RegularExpressionFlags::ASCII_8BIT = T.let(T.unsafe(nil), Integer) + +# e - forces the EUC-JP encoding +# +# source://prism//lib/prism/node.rb#18575 +Prism::RegularExpressionFlags::EUC_JP = T.let(T.unsafe(nil), Integer) + +# x - ignores whitespace and allows comments in regular expressions +# +# source://prism//lib/prism/node.rb#18566 +Prism::RegularExpressionFlags::EXTENDED = T.let(T.unsafe(nil), Integer) + +# internal bytes forced the encoding to binary +# +# source://prism//lib/prism/node.rb#18590 +Prism::RegularExpressionFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) + +# internal bytes forced the encoding to US-ASCII +# +# source://prism//lib/prism/node.rb#18593 +Prism::RegularExpressionFlags::FORCED_US_ASCII_ENCODING = T.let(T.unsafe(nil), Integer) + +# internal bytes forced the encoding to UTF-8 +# +# source://prism//lib/prism/node.rb#18587 +Prism::RegularExpressionFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) + +# i - ignores the case of characters when matching +# +# source://prism//lib/prism/node.rb#18563 +Prism::RegularExpressionFlags::IGNORE_CASE = T.let(T.unsafe(nil), Integer) + +# m - allows $ to match the end of lines within strings +# +# source://prism//lib/prism/node.rb#18569 +Prism::RegularExpressionFlags::MULTI_LINE = T.let(T.unsafe(nil), Integer) + +# o - only interpolates values into the regular expression once +# +# source://prism//lib/prism/node.rb#18572 +Prism::RegularExpressionFlags::ONCE = T.let(T.unsafe(nil), Integer) + +# u - forces the UTF-8 encoding +# +# source://prism//lib/prism/node.rb#18584 +Prism::RegularExpressionFlags::UTF_8 = T.let(T.unsafe(nil), Integer) + +# s - forces the Windows-31J encoding +# +# source://prism//lib/prism/node.rb#18581 +Prism::RegularExpressionFlags::WINDOWS_31J = T.let(T.unsafe(nil), Integer) + +# Represents a regular expression literal with no interpolation. +# +# /foo/i +# ^^^^^^ +# +# source://prism//lib/prism/node.rb#15249 +class Prism::RegularExpressionNode < ::Prism::Node + include ::Prism::RegularExpressionOptions + + # Initialize a new RegularExpressionNode node. + # + # @return [RegularExpressionNode] a new instance of RegularExpressionNode + # + # source://prism//lib/prism/node.rb#15251 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).void + end + def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end + # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#17751 + # source://prism//lib/prism/node.rb#15424 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17659 + # source://prism//lib/prism/node.rb#15263 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader arguments: ArgumentsNode? + # def ascii_8bit?: () -> bool # - # source://prism//lib/prism/node.rb#17701 - sig { returns(T.nilable(Prism::ArgumentsNode)) } - def arguments; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15321 + sig { returns(T::Boolean) } + def ascii_8bit?; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17664 + # source://prism//lib/prism/node.rb#15268 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end + # def closing: () -> String + # + # source://prism//lib/prism/node.rb#15403 + sig { returns(String) } + def closing; end + + # attr_reader closing_loc: Location + # + # source://prism//lib/prism/node.rb#15377 + sig { returns(Prism::Location) } + def closing_loc; end + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17676 + # source://prism//lib/prism/node.rb#15278 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17669 + # source://prism//lib/prism/node.rb#15273 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?keyword_loc: Location, ?arguments: ArgumentsNode?, ?location: Location) -> ReturnNode + # def content: () -> String # - # source://prism//lib/prism/node.rb#17681 + # source://prism//lib/prism/node.rb#15398 + sig { returns(String) } + def content; end + + # attr_reader content_loc: Location + # + # source://prism//lib/prism/node.rb#15364 + sig { returns(Prism::Location) } + def content_loc; end + + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode + # + # source://prism//lib/prism/node.rb#15283 sig do params( - keyword_loc: Prism::Location, - arguments: T.nilable(Prism::ArgumentsNode), - location: Prism::Location - ).returns(Prism::ReturnNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + content_loc: Prism::Location, + closing_loc: Prism::Location, + unescaped: String + ).returns(Prism::RegularExpressionNode) end - def copy(keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17664 + # source://prism//lib/prism/node.rb#15268 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, arguments: ArgumentsNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String } # - # source://prism//lib/prism/node.rb#17689 + # source://prism//lib/prism/node.rb#15291 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end - - # def inspect(NodeInspector inspector) -> String + # def euc_jp?: () -> bool # - # source://prism//lib/prism/node.rb#17709 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def keyword: () -> String + # @return [Boolean] # - # source://prism//lib/prism/node.rb#17704 - sig { returns(String) } - def keyword; end + # source://prism//lib/prism/node.rb#15316 + sig { returns(T::Boolean) } + def euc_jp?; end - # attr_reader keyword_loc: Location + # def extended?: () -> bool # - # source://prism//lib/prism/node.rb#17694 - sig { returns(Prism::Location) } - def keyword_loc; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15301 + sig { returns(T::Boolean) } + def extended?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def forced_binary_encoding?: () -> bool # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#15341 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end + + # def forced_us_ascii_encoding?: () -> bool # - # source://prism//lib/prism/node.rb#17735 - sig { override.returns(Symbol) } - def type; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15346 + sig { returns(T::Boolean) } + def forced_us_ascii_encoding?; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17745 - def type; end - end -end + # def forced_utf8_encoding?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15336 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end -# Represents the `self` keyword. -# -# self -# ^^^^ -# -# source://prism//lib/prism/node.rb#17762 -class Prism::SelfNode < ::Prism::Node - # def initialize: (Location location) -> void + # def ignore_case?: () -> bool # - # @return [SelfNode] a new instance of SelfNode + # @return [Boolean] # - # source://prism//lib/prism/node.rb#17764 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#15296 + sig { returns(T::Boolean) } + def ignore_case?; end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # def inspect -> String # - # source://prism//lib/prism/node.rb#17839 - def ===(other); end + # source://prism//lib/prism/node.rb#15408 + sig { override.returns(String) } + def inspect; end - # def accept: (Visitor visitor) -> void + # def multi_line?: () -> bool # - # source://prism//lib/prism/node.rb#17771 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15306 + sig { returns(T::Boolean) } + def multi_line?; end - # def child_nodes: () -> Array[nil | Node] + # def once?: () -> bool # - # source://prism//lib/prism/node.rb#17776 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15311 + sig { returns(T::Boolean) } + def once?; end - # def comment_targets: () -> Array[Node | Location] + # def opening: () -> String # - # source://prism//lib/prism/node.rb#17786 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/node.rb#15393 + sig { returns(String) } + def opening; end - # def compact_child_nodes: () -> Array[Node] + # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#17781 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/node.rb#15351 + sig { returns(Prism::Location) } + def opening_loc; end - # def copy: (?location: Location) -> SelfNode + sig { returns(Integer) } + def options; end + + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#17791 - sig { params(location: Prism::Location).returns(Prism::SelfNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15385 + def save_closing_loc(repository); end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Save the content_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#17776 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/node.rb#15372 + def save_content_loc(repository); end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#17799 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/node.rb#15359 + def save_opening_loc(repository); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#15413 + sig { override.returns(Symbol) } + def type; end - # def inspect(NodeInspector inspector) -> String + # attr_reader unescaped: String # - # source://prism//lib/prism/node.rb#17804 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15390 + sig { returns(String) } + def unescaped; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # def utf_8?: () -> bool # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#15331 + sig { returns(T::Boolean) } + def utf_8?; end + + # def windows_31j?: () -> bool # - # def type: () -> Symbol + # @return [Boolean] # - # source://prism//lib/prism/node.rb#17823 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#15326 + sig { returns(T::Boolean) } + def windows_31j?; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#17833 + # source://prism//lib/prism/node.rb#15418 def type; end end end -# A module responsible for deserializing parse results. +# source://prism//lib/prism/node_ext.rb#20 +module Prism::RegularExpressionOptions + # Returns a numeric value that represents the flags that were used to create + # the regular expression. + # + # source://prism//lib/prism/node_ext.rb#23 + def options; end +end + +# Prism parses deterministically for the same input. This provides a nice +# property that is exposed through the #node_id API on nodes. Effectively this +# means that for the same input, these values will remain consistent every +# time the source is parsed. This means we can reparse the source same with a +# #node_id value and find the exact same node again. # -# source://prism//lib/prism/serialize.rb#14 -module Prism::Serialize +# The Relocation module provides an API around this property. It allows you to +# "save" nodes and locations using a minimal amount of memory (just the +# node_id and a field identifier) and then reify them later. +# +# source://prism//lib/prism/relocation.rb#13 +module Prism::Relocation class << self - # Deserialize the AST represented by the given string into a parse result. + # Create a new repository for the given filepath. # - # source://prism//lib/prism/serialize.rb#28 - def load(input, serialized); end + # source://prism//lib/prism/relocation.rb#495 + def filepath(value); end - # Deserialize the tokens represented by the given string into a parse - # result. + # Create a new repository for the given string. # - # source://prism//lib/prism/serialize.rb#40 - def load_tokens(source, serialized); end + # source://prism//lib/prism/relocation.rb#500 + def string(value); end end end -# source://prism//lib/prism/serialize.rb#44 -class Prism::Serialize::Loader - # @return [Loader] a new instance of Loader +# A field representing the start and end character columns. +# +# source://prism//lib/prism/relocation.rb#269 +class Prism::Relocation::CharacterColumnsField + # Fetches the start and end character column of a value. # - # source://prism//lib/prism/serialize.rb#80 - def initialize(source, serialized); end + # source://prism//lib/prism/relocation.rb#271 + def fields(value); end +end - # Returns the value of attribute constant_pool. +# A field representing the start and end character offsets. +# +# source://prism//lib/prism/relocation.rb#217 +class Prism::Relocation::CharacterOffsetsField + # Fetches the start and end character offset of a value. # - # source://prism//lib/prism/serialize.rb#77 - def constant_pool; end + # source://prism//lib/prism/relocation.rb#219 + def fields(value); end +end - # Returns the value of attribute constant_pool_offset. +# A field representing the start and end code unit columns for a specific +# encoding. +# +# source://prism//lib/prism/relocation.rb#281 +class Prism::Relocation::CodeUnitColumnsField + # Initialize a new field with the associated repository and encoding. + # + # @return [CodeUnitColumnsField] a new instance of CodeUnitColumnsField # - # source://prism//lib/prism/serialize.rb#77 - def constant_pool_offset; end + # source://prism//lib/prism/relocation.rb#290 + def initialize(repository, encoding); end - # Returns the value of attribute encoding. + # The associated encoding for the code units. # - # source://prism//lib/prism/serialize.rb#76 + # source://prism//lib/prism/relocation.rb#287 def encoding; end - # Returns the value of attribute input. + # Fetches the start and end code units column of a value for a particular + # encoding. # - # source://prism//lib/prism/serialize.rb#76 - def input; end + # source://prism//lib/prism/relocation.rb#298 + def fields(value); end - # Returns the value of attribute io. + # The repository object that is used for lazily creating a code units + # cache. # - # source://prism//lib/prism/serialize.rb#76 - def io; end + # source://prism//lib/prism/relocation.rb#284 + def repository; end - # source://prism//lib/prism/serialize.rb#118 - def load_comments; end + private - # source://prism//lib/prism/serialize.rb#104 - def load_encoding; end + # Lazily create a code units cache for the associated encoding. + # + # source://prism//lib/prism/relocation.rb#308 + def cache; end +end - # source://prism//lib/prism/serialize.rb#95 - def load_header; end +# A field representing the start and end code unit offsets. +# +# source://prism//lib/prism/relocation.rb#228 +class Prism::Relocation::CodeUnitOffsetsField + # Initialize a new field with the associated repository and encoding. + # + # @return [CodeUnitOffsetsField] a new instance of CodeUnitOffsetsField + # + # source://prism//lib/prism/relocation.rb#237 + def initialize(repository, encoding); end - # source://prism//lib/prism/serialize.rb#114 - def load_line_offsets; end + # The associated encoding for the code units. + # + # source://prism//lib/prism/relocation.rb#234 + def encoding; end - # source://prism//lib/prism/serialize.rb#416 - def load_metadata; end + # Fetches the start and end code units offset of a value for a particular + # encoding. + # + # source://prism//lib/prism/relocation.rb#245 + def fields(value); end - # source://prism//lib/prism/serialize.rb#450 - def load_nodes; end + # A pointer to the repository object that is used for lazily creating a + # code units cache. + # + # source://prism//lib/prism/relocation.rb#231 + def repository; end - # source://prism//lib/prism/serialize.rb#464 - def load_result; end + private - # source://prism//lib/prism/serialize.rb#110 - def load_start_line; end + # Lazily create a code units cache for the associated encoding. + # + # source://prism//lib/prism/relocation.rb#255 + def cache; end +end - # source://prism//lib/prism/serialize.rb#425 - def load_tokens; end +# A field representing the start and end byte columns. +# +# source://prism//lib/prism/relocation.rb#261 +class Prism::Relocation::ColumnsField + # Fetches the start and end byte column of a value. + # + # source://prism//lib/prism/relocation.rb#263 + def fields(value); end +end - # source://prism//lib/prism/serialize.rb#438 - def load_tokens_result; end +# An abstract field used as the parent class of the two comments fields. +# +# source://prism//lib/prism/relocation.rb#314 +class Prism::Relocation::CommentsField + private - # Returns the value of attribute serialized. + # Create comment objects from the given values. # - # source://prism//lib/prism/serialize.rb#76 - def serialized; end + # source://prism//lib/prism/relocation.rb#329 + def comments(values); end +end - # Returns the value of attribute source. +# An object that represents a slice of a comment. +# +# source://prism//lib/prism/relocation.rb#316 +class Prism::Relocation::CommentsField::Comment + # Initialize a new comment with the given slice. # - # source://prism//lib/prism/serialize.rb#77 - def source; end + # @return [Comment] a new instance of Comment + # + # source://prism//lib/prism/relocation.rb#321 + def initialize(slice); end - # Returns the value of attribute start_line. + # The slice of the comment. # - # source://prism//lib/prism/serialize.rb#78 - def start_line; end + # source://prism//lib/prism/relocation.rb#318 + def slice; end +end - private +# An entry in a repository that will lazily reify its values when they are +# first accessed. +# +# source://prism//lib/prism/relocation.rb#16 +class Prism::Relocation::Entry + # Initialize a new entry with the given repository. + # + # @return [Entry] a new instance of Entry + # + # source://prism//lib/prism/relocation.rb#24 + def initialize(repository); end - # source://prism//lib/prism/serialize.rb#550 - def load_constant(index); end + # Fetch the leading and trailing comments of the value. + # + # source://prism//lib/prism/relocation.rb#119 + def comments; end - # source://prism//lib/prism/serialize.rb#503 - def load_double; end + # Fetch the end character column of the value. + # + # source://prism//lib/prism/relocation.rb#92 + def end_character_column; end - # source://prism//lib/prism/serialize.rb#518 - def load_embedded_string; end + # Fetch the end character offset of the value. + # + # source://prism//lib/prism/relocation.rb#60 + def end_character_offset; end - # source://prism//lib/prism/serialize.rb#580 - def load_error_level; end + # Fetch the end code units column of the value, for the encoding that was + # configured on the repository. + # + # source://prism//lib/prism/relocation.rb#104 + def end_code_units_column; end - # source://prism//lib/prism/serialize.rb#492 - def load_integer; end + # Fetch the end code units offset of the value, for the encoding that was + # configured on the repository. + # + # source://prism//lib/prism/relocation.rb#72 + def end_code_units_offset; end + + # Fetch the end byte column of the value. + # + # source://prism//lib/prism/relocation.rb#82 + def end_column; end - # source://prism//lib/prism/serialize.rb#534 - def load_location; end + # Fetch the end line of the value. + # + # source://prism//lib/prism/relocation.rb#40 + def end_line; end + + # Fetch the end byte offset of the value. + # + # source://prism//lib/prism/relocation.rb#50 + def end_offset; end - # source://prism//lib/prism/serialize.rb#538 - def load_location_object; end + # Fetch the filepath of the value. + # + # source://prism//lib/prism/relocation.rb#30 + def filepath; end - # source://prism//lib/prism/serialize.rb#609 - def load_node; end + # Fetch the leading comments of the value. + # + # source://prism//lib/prism/relocation.rb#109 + def leading_comments; end - # source://prism//lib/prism/serialize.rb#575 - def load_optional_constant; end + # Reify the values on this entry with the given values. This is an + # internal-only API that is called from the repository when it is time to + # reify the values. + # + # source://prism//lib/prism/relocation.rb#126 + def reify!(values); end - # source://prism//lib/prism/serialize.rb#542 - def load_optional_location; end + # Fetch the start character column of the value. + # + # source://prism//lib/prism/relocation.rb#87 + def start_character_column; end - # source://prism//lib/prism/serialize.rb#546 - def load_optional_location_object; end + # Fetch the start character offset of the value. + # + # source://prism//lib/prism/relocation.rb#55 + def start_character_offset; end - # source://prism//lib/prism/serialize.rb#511 - def load_optional_node; end + # Fetch the start code units column of the value, for the encoding that + # was configured on the repository. + # + # source://prism//lib/prism/relocation.rb#98 + def start_code_units_column; end - # source://prism//lib/prism/serialize.rb#571 - def load_required_constant; end + # Fetch the start code units offset of the value, for the encoding that + # was configured on the repository. + # + # source://prism//lib/prism/relocation.rb#66 + def start_code_units_offset; end - # source://prism//lib/prism/serialize.rb#522 - def load_string; end + # Fetch the start byte column of the value. + # + # source://prism//lib/prism/relocation.rb#77 + def start_column; end - # source://prism//lib/prism/serialize.rb#507 - def load_uint32; end + # Fetch the start line of the value. + # + # source://prism//lib/prism/relocation.rb#35 + def start_line; end - # source://prism//lib/prism/serialize.rb#487 - def load_varsint; end + # Fetch the start byte offset of the value. + # + # source://prism//lib/prism/relocation.rb#45 + def start_offset; end - # variable-length integer using https://en.wikipedia.org/wiki/LEB128 - # This is also what protobuf uses: https://protobuf.dev/programming-guides/encoding/#varints + # Fetch the trailing comments of the value. # - # source://prism//lib/prism/serialize.rb#473 - def load_varuint; end + # source://prism//lib/prism/relocation.rb#114 + def trailing_comments; end - # source://prism//lib/prism/serialize.rb#595 - def load_warning_level; end -end + private -# source://prism//lib/prism/serialize.rb#127 -Prism::Serialize::Loader::DIAGNOSTIC_TYPES = T.let(T.unsafe(nil), Array) + # Fetch a value from the entry, raising an error if it is missing. + # + # source://prism//lib/prism/relocation.rb#134 + def fetch_value(name); end -# StringIO is synchronized and that adds a high overhead on TruffleRuby. -# -# source://prism//lib/prism/serialize.rb#72 -Prism::Serialize::Loader::FastStringIO = StringIO + # Return the values from the repository, reifying them if necessary. + # + # source://prism//lib/prism/relocation.rb#142 + def values; end +end -# The major version of prism that we are expecting to find in the serialized -# strings. +# Raised if a value that could potentially be on an entry is missing +# because it was either not configured on the repository or it has not yet +# been fetched. # -# source://prism//lib/prism/serialize.rb#17 -Prism::Serialize::MAJOR_VERSION = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#20 +class Prism::Relocation::Entry::MissingValueError < ::StandardError; end -# The minor version of prism that we are expecting to find in the serialized -# strings. +# A field that represents the file path. # -# source://prism//lib/prism/serialize.rb#21 -Prism::Serialize::MINOR_VERSION = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#185 +class Prism::Relocation::FilepathField + # Initialize a new field with the given file path. + # + # @return [FilepathField] a new instance of FilepathField + # + # source://prism//lib/prism/relocation.rb#190 + def initialize(value); end -# The patch version of prism that we are expecting to find in the serialized -# strings. + # Fetch the file path. + # + # source://prism//lib/prism/relocation.rb#195 + def fields(_value); end + + # The file path that this field represents. + # + # source://prism//lib/prism/relocation.rb#187 + def value; end +end + +# A field representing the leading comments. # -# source://prism//lib/prism/serialize.rb#25 -Prism::Serialize::PATCH_VERSION = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#335 +class Prism::Relocation::LeadingCommentsField < ::Prism::Relocation::CommentsField + # Fetches the leading comments of a value. + # + # source://prism//lib/prism/relocation.rb#337 + def fields(value); end +end -# The token types that can be indexed by their enum values. +# A field representing the start and end lines. # -# source://prism//lib/prism/serialize.rb#1833 -Prism::Serialize::TOKEN_TYPES = T.let(T.unsafe(nil), Array) +# source://prism//lib/prism/relocation.rb#201 +class Prism::Relocation::LinesField + # Fetches the start and end line of a value. + # + # source://prism//lib/prism/relocation.rb#203 + def fields(value); end +end -# This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified. +# A field representing the start and end byte offsets. # -# C = { a: 1 } -# ^^^^^^^^^^^^ +# source://prism//lib/prism/relocation.rb#209 +class Prism::Relocation::OffsetsField + # Fetches the start and end byte offset of a value. + # + # source://prism//lib/prism/relocation.rb#211 + def fields(value); end +end + +# A repository is a configured collection of fields and a set of entries +# that knows how to reparse a source and reify the values. # -# source://prism//lib/prism/node.rb#17849 -class Prism::ShareableConstantNode < ::Prism::Node - # def initialize: (Integer flags, ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode write, Location location) -> void +# source://prism//lib/prism/relocation.rb#352 +class Prism::Relocation::Repository + # Initialize a new repository with the given source. # - # @return [ShareableConstantNode] a new instance of ShareableConstantNode + # @return [Repository] a new instance of Repository # - # source://prism//lib/prism/node.rb#17851 - sig do - params( - source: Prism::Source, - flags: Integer, - write: T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode), - location: Prism::Location - ).void - end - def initialize(source, flags, write, location); end + # source://prism//lib/prism/relocation.rb#369 + def initialize(source); end - # Implements case-equality for the node. This is effectively == but without - # comparing the value of locations. Locations are checked only for presence. + # Configure the character columns field for this repository and return + # self. # - # source://prism//lib/prism/node.rb#17954 - def ===(other); end + # source://prism//lib/prism/relocation.rb#415 + def character_columns; end - # def accept: (Visitor visitor) -> void + # Configure the character offsets field for this repository and return + # self. # - # source://prism//lib/prism/node.rb#17860 - sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } - def accept(visitor); end + # source://prism//lib/prism/relocation.rb#398 + def character_offsets; end - # def child_nodes: () -> Array[nil | Node] + # Configure the code unit columns field for this repository for a specific + # encoding and return self. # - # source://prism//lib/prism/node.rb#17865 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def child_nodes; end + # source://prism//lib/prism/relocation.rb#421 + def code_unit_columns(encoding); end - # def comment_targets: () -> Array[Node | Location] + # Configure the code unit offsets field for this repository for a specific + # encoding and return self. # - # source://prism//lib/prism/node.rb#17875 - sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } - def comment_targets; end + # source://prism//lib/prism/relocation.rb#404 + def code_unit_offsets(encoding); end - # def compact_child_nodes: () -> Array[Node] + # Create a code units cache for the given encoding from the source. # - # source://prism//lib/prism/node.rb#17870 - sig { override.returns(T::Array[Prism::Node]) } - def compact_child_nodes; end + # source://prism//lib/prism/relocation.rb#376 + def code_units_cache(encoding); end - # def copy: (?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode, ?location: Location) -> ShareableConstantNode + # Configure the columns field for this repository and return self. # - # source://prism//lib/prism/node.rb#17880 - sig do - params( - flags: Integer, - write: T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode), - location: Prism::Location - ).returns(Prism::ShareableConstantNode) - end - def copy(flags: T.unsafe(nil), write: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/relocation.rb#409 + def columns; end - # def child_nodes: () -> Array[nil | Node] - # def deconstruct: () -> Array[nil | Node] + # Configure both the leading and trailing comment fields for this + # repository and return self. # - # source://prism//lib/prism/node.rb#17865 - sig { override.returns(T::Array[T.nilable(Prism::Node)]) } - def deconstruct; end + # source://prism//lib/prism/relocation.rb#439 + def comments; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode, location: Location } + # This method is called from nodes and locations when they want to enter + # themselves into the repository. It it internal-only and meant to be + # called from the #save* APIs. # - # source://prism//lib/prism/node.rb#17888 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end + # source://prism//lib/prism/relocation.rb#446 + def enter(node_id, field_name); end - # def experimental_copy?: () -> bool + # The entries that have been saved on this repository. # - # @return [Boolean] + # source://prism//lib/prism/relocation.rb#366 + def entries; end + + # The fields that have been configured on this repository. # - # source://prism//lib/prism/node.rb#17910 - sig { returns(T::Boolean) } - def experimental_copy?; end + # source://prism//lib/prism/relocation.rb#363 + def fields; end - # def experimental_everything?: () -> bool + # Configure the filepath field for this repository and return self. # - # @return [Boolean] + # @raise [ConfigurationError] # - # source://prism//lib/prism/node.rb#17905 - sig { returns(T::Boolean) } - def experimental_everything?; end + # source://prism//lib/prism/relocation.rb#381 + def filepath; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end + # Configure the leading comments field for this repository and return + # self. + # + # source://prism//lib/prism/relocation.rb#427 + def leading_comments; end - # def inspect(NodeInspector inspector) -> String + # Configure the lines field for this repository and return self. # - # source://prism//lib/prism/node.rb#17915 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/relocation.rb#387 + def lines; end - # def literal?: () -> bool + # Configure the offsets field for this repository and return self. # - # @return [Boolean] + # source://prism//lib/prism/relocation.rb#392 + def offsets; end + + # This method is called from the entries in the repository when they need + # to reify their values. It is internal-only and meant to be called from + # the various value APIs. # - # source://prism//lib/prism/node.rb#17900 - sig { returns(T::Boolean) } - def literal?; end + # source://prism//lib/prism/relocation.rb#455 + def reify!; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # The source associated with this repository. This will be either a + # SourceFilepath (the most common use case) or a SourceString. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/relocation.rb#360 + def source; end + + # Configure the trailing comments field for this repository and return + # self. + # + # source://prism//lib/prism/relocation.rb#433 + def trailing_comments; end + + private + + # Append the given field to the repository and return the repository so + # that these calls can be chained. # - # def type: () -> Symbol + # @raise [ConfigurationError] # - # source://prism//lib/prism/node.rb#17938 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/relocation.rb#487 + def field(name, value); end +end - # The constant write that should be modified with the shareability state. +# Raised when multiple fields of the same type are configured on the same +# repository. +# +# source://prism//lib/prism/relocation.rb#355 +class Prism::Relocation::Repository::ConfigurationError < ::StandardError; end + +# Represents the source of a repository that will be reparsed. +# +# source://prism//lib/prism/relocation.rb#148 +class Prism::Relocation::Source + # Initialize the source with the given value. # - # source://prism//lib/prism/node.rb#17897 - sig do - returns(T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode)) - end - def write; end + # @return [Source] a new instance of Source + # + # source://prism//lib/prism/relocation.rb#153 + def initialize(value); end - protected + # Create a code units cache for the given encoding. + # + # source://prism//lib/prism/relocation.rb#163 + def code_units_cache(encoding); end - # protected attr_reader flags: Integer + # Reparse the value and return the parse result. # - # source://prism//lib/prism/node.rb#17893 - sig { returns(Integer) } - def flags; end + # @raise [NotImplementedError] + # + # source://prism//lib/prism/relocation.rb#158 + def result; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#17948 - def type; end - end + # The value that will need to be reparsed. + # + # source://prism//lib/prism/relocation.rb#150 + def value; end end -# Flags for shareable constant nodes. -# -# source://prism//lib/prism/node.rb#20457 -module Prism::ShareableConstantNodeFlags; end - -# constant writes that should be modified with shareable constant value experimental copy +# A source that is represented by a file path. # -# source://prism//lib/prism/node.rb#20465 -Prism::ShareableConstantNodeFlags::EXPERIMENTAL_COPY = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#169 +class Prism::Relocation::SourceFilepath < ::Prism::Relocation::Source + # Reparse the file and return the parse result. + # + # source://prism//lib/prism/relocation.rb#171 + def result; end +end -# constant writes that should be modified with shareable constant value experimental everything +# A source that is represented by a string. # -# source://prism//lib/prism/node.rb#20462 -Prism::ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#177 +class Prism::Relocation::SourceString < ::Prism::Relocation::Source + # Reparse the string and return the parse result. + # + # source://prism//lib/prism/relocation.rb#179 + def result; end +end -# constant writes that should be modified with shareable constant value literal +# A field representing the trailing comments. # -# source://prism//lib/prism/node.rb#20459 -Prism::ShareableConstantNodeFlags::LITERAL = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/relocation.rb#343 +class Prism::Relocation::TrailingCommentsField < ::Prism::Relocation::CommentsField + # Fetches the trailing comments of a value. + # + # source://prism//lib/prism/relocation.rb#345 + def fields(value); end +end -# Represents a singleton class declaration involving the `class` keyword. +# Represents a required keyword parameter to a method, block, or lambda definition. # -# class << self end -# ^^^^^^^^^^^^^^^^^ +# def a(b: ) +# ^^ +# end # -# source://prism//lib/prism/node.rb#17965 -class Prism::SingletonClassNode < ::Prism::Node - # def initialize: (Array[Symbol] locals, Location class_keyword_loc, Location operator_loc, Prism::node expression, Prism::node? body, Location end_keyword_loc, Location location) -> void +# source://prism//lib/prism/node.rb#15439 +class Prism::RequiredKeywordParameterNode < ::Prism::Node + # Initialize a new RequiredKeywordParameterNode node. # - # @return [SingletonClassNode] a new instance of SingletonClassNode + # @return [RequiredKeywordParameterNode] a new instance of RequiredKeywordParameterNode # - # source://prism//lib/prism/node.rb#17967 + # source://prism//lib/prism/node.rb#15441 sig do params( source: Prism::Source, - locals: T::Array[Symbol], - class_keyword_loc: Prism::Location, - operator_loc: Prism::Location, - expression: Prism::Node, - body: T.nilable(Prism::Node), - end_keyword_loc: Prism::Location, - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location ).void end - def initialize(source, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, name, name_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18108 + # source://prism//lib/prism/node.rb#15521 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#17980 + # source://prism//lib/prism/node.rb#15451 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Prism::node? - # - # source://prism//lib/prism/node.rb#18036 - sig { returns(T.nilable(Prism::Node)) } - def body; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17985 + # source://prism//lib/prism/node.rb#15456 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def class_keyword: () -> String - # - # source://prism//lib/prism/node.rb#18046 - sig { returns(String) } - def class_keyword; end - - # attr_reader class_keyword_loc: Location - # - # source://prism//lib/prism/node.rb#18019 - sig { returns(Prism::Location) } - def class_keyword_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#17998 + # source://prism//lib/prism/node.rb#15466 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#17990 + # source://prism//lib/prism/node.rb#15461 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: Prism::node?, ?end_keyword_loc: Location, ?location: Location) -> SingletonClassNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode # - # source://prism//lib/prism/node.rb#18003 + # source://prism//lib/prism/node.rb#15471 sig do params( - locals: T::Array[Symbol], - class_keyword_loc: Prism::Location, - operator_loc: Prism::Location, - expression: Prism::Node, - body: T.nilable(Prism::Node), - end_keyword_loc: Prism::Location, - location: Prism::Location - ).returns(Prism::SingletonClassNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location + ).returns(Prism::RequiredKeywordParameterNode) end - def copy(locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#17985 + # source://prism//lib/prism/node.rb#15456 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Prism::node, body: Prism::node?, end_keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location } # - # source://prism//lib/prism/node.rb#18011 + # source://prism//lib/prism/node.rb#15479 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # def end_keyword: () -> String - # - # source://prism//lib/prism/node.rb#18056 - sig { returns(String) } - def end_keyword; end - - # attr_reader end_keyword_loc: Location - # - # source://prism//lib/prism/node.rb#18039 - sig { returns(Prism::Location) } - def end_keyword_loc; end - - # attr_reader expression: Prism::node - # - # source://prism//lib/prism/node.rb#18033 - sig { returns(Prism::Node) } - def expression; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#18061 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # attr_reader locals: Array[Symbol] + # def inspect -> String # - # source://prism//lib/prism/node.rb#18016 - sig { returns(T::Array[Symbol]) } - def locals; end + # source://prism//lib/prism/node.rb#15505 + sig { override.returns(String) } + def inspect; end - # def operator: () -> String + # attr_reader name: Symbol # - # source://prism//lib/prism/node.rb#18051 - sig { returns(String) } - def operator; end + # source://prism//lib/prism/node.rb#15489 + sig { returns(Symbol) } + def name; end - # attr_reader operator_loc: Location + # attr_reader name_loc: Location # - # source://prism//lib/prism/node.rb#18026 + # source://prism//lib/prism/node.rb#15492 sig { returns(Prism::Location) } - def operator_loc; end + def name_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # def repeated_parameter?: () -> bool # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#15484 + sig { returns(T::Boolean) } + def repeated_parameter?; end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15500 + def save_name_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18092 + # source://prism//lib/prism/node.rb#15510 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#18102 + # source://prism//lib/prism/node.rb#15515 def type; end end end -# This represents a source of Ruby code that has been parsed. It is used in -# conjunction with locations to allow them to resolve line numbers and source -# ranges. +# Represents a required parameter to a method, block, or lambda definition. # -# source://prism//lib/prism/parse_result.rb#7 -class Prism::Source - # Create a new source object with the given source code. - # - # @return [Source] a new instance of Source - # - # source://prism//lib/prism/parse_result.rb#18 - sig { params(source: String, start_line: Integer, offsets: T::Array[Integer]).void } - def initialize(source, start_line = T.unsafe(nil), offsets = T.unsafe(nil)); end - - # Return the column number in characters for the given byte offset. - # - # source://prism//lib/prism/parse_result.rb#59 - sig { params(byte_offset: Integer).returns(Integer) } - def character_column(byte_offset); end - - # Return the character offset for the given byte offset. - # - # source://prism//lib/prism/parse_result.rb#54 - sig { params(byte_offset: Integer).returns(Integer) } - def character_offset(byte_offset); end - - # Returns the column number in code units for the given encoding for the - # given byte offset. - # - # source://prism//lib/prism/parse_result.rb#76 - sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } - def code_units_column(byte_offset, encoding); end - - # Returns the offset from the start of the file for the given byte offset - # counting in code units for the given encoding. - # - # This method is tested with UTF-8, UTF-16, and UTF-32. If there is the - # concept of code units that differs from the number of characters in other - # encodings, it is not captured here. - # - # source://prism//lib/prism/parse_result.rb#69 - sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } - def code_units_offset(byte_offset, encoding); end - - # Return the column number for the given byte offset. - # - # source://prism//lib/prism/parse_result.rb#49 - sig { params(byte_offset: Integer).returns(Integer) } - def column(byte_offset); end - - # Returns the encoding of the source code, which is set by parameters to the - # parser or by the encoding magic comment. - # - # source://prism//lib/prism/parse_result.rb#26 - sig { returns(Encoding) } - def encoding; end - - # Binary search through the offsets to find the line number for the given - # byte offset. - # - # source://prism//lib/prism/parse_result.rb#38 - sig { params(byte_offset: Integer).returns(Integer) } - def line(byte_offset); end - - # Return the byte offset of the start of the line corresponding to the given - # byte offset. - # - # source://prism//lib/prism/parse_result.rb#44 - sig { params(byte_offset: Integer).returns(Integer) } - def line_start(byte_offset); end - - # The list of newline byte offsets in the source code. - # - # source://prism//lib/prism/parse_result.rb#15 - sig { returns(T::Array[Integer]) } - def offsets; end - - # Perform a byteslice on the source code using the given byte offset and - # byte length. - # - # source://prism//lib/prism/parse_result.rb#32 - sig { params(byte_offset: Integer, length: Integer).returns(String) } - def slice(byte_offset, length); end - - # The source code that this source object represents. - # - # source://prism//lib/prism/parse_result.rb#9 - sig { returns(String) } - def source; end - - # The line number where this source starts. - # - # source://prism//lib/prism/parse_result.rb#12 - sig { returns(Integer) } - def start_line; end - - private - - # Binary search through the offsets to find the line number for the given - # byte offset. - # - # source://prism//lib/prism/parse_result.rb#84 - def find_line(byte_offset); end -end - -# Represents the use of the `__ENCODING__` keyword. -# -# __ENCODING__ -# ^^^^^^^^^^^^ +# def a(b) +# ^ +# end # -# source://prism//lib/prism/node.rb#18124 -class Prism::SourceEncodingNode < ::Prism::Node - # def initialize: (Location location) -> void +# source://prism//lib/prism/node.rb#15534 +class Prism::RequiredParameterNode < ::Prism::Node + # Initialize a new RequiredParameterNode node. # - # @return [SourceEncodingNode] a new instance of SourceEncodingNode + # @return [RequiredParameterNode] a new instance of RequiredParameterNode # - # source://prism//lib/prism/node.rb#18126 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#15536 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } + def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18201 + # source://prism//lib/prism/node.rb#15602 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18133 + # source://prism//lib/prism/node.rb#15545 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18138 + # source://prism//lib/prism/node.rb#15550 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18148 + # source://prism//lib/prism/node.rb#15560 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18143 + # source://prism//lib/prism/node.rb#15555 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> SourceEncodingNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode # - # source://prism//lib/prism/node.rb#18153 - sig { params(location: Prism::Location).returns(Prism::SourceEncodingNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15565 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::RequiredParameterNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18138 + # source://prism//lib/prism/node.rb#15550 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # - # source://prism//lib/prism/node.rb#18161 + # source://prism//lib/prism/node.rb#15573 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#18166 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15586 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # attr_reader name: Symbol # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#15583 + sig { returns(Symbol) } + def name; end + + # def repeated_parameter?: () -> bool # - # def type: () -> Symbol + # @return [Boolean] # - # source://prism//lib/prism/node.rb#18185 + # source://prism//lib/prism/node.rb#15578 + sig { returns(T::Boolean) } + def repeated_parameter?; end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#15591 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#18195 + # source://prism//lib/prism/node.rb#15596 def type; end end end -# Represents the use of the `__FILE__` keyword. +# Represents an expression modified with a rescue. # -# __FILE__ -# ^^^^^^^^ +# foo rescue nil +# ^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#18210 -class Prism::SourceFileNode < ::Prism::Node - # def initialize: (Integer flags, String filepath, Location location) -> void +# source://prism//lib/prism/node.rb#15613 +class Prism::RescueModifierNode < ::Prism::Node + # Initialize a new RescueModifierNode node. # - # @return [SourceFileNode] a new instance of SourceFileNode + # @return [RescueModifierNode] a new instance of RescueModifierNode # - # source://prism//lib/prism/node.rb#18212 - sig { params(source: Prism::Source, flags: Integer, filepath: String, location: Prism::Location).void } - def initialize(source, flags, filepath, location); end + # source://prism//lib/prism/node.rb#15615 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + keyword_loc: Prism::Location, + rescue_expression: Prism::Node + ).void + end + def initialize(source, node_id, location, flags, expression, keyword_loc, rescue_expression); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18319 + # source://prism//lib/prism/node.rb#15699 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18221 + # source://prism//lib/prism/node.rb#15626 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18226 + # source://prism//lib/prism/node.rb#15631 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18236 + # source://prism//lib/prism/node.rb#15641 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18231 + # source://prism//lib/prism/node.rb#15636 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?filepath: String, ?location: Location) -> SourceFileNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode # - # source://prism//lib/prism/node.rb#18241 - sig { params(flags: Integer, filepath: String, location: Prism::Location).returns(Prism::SourceFileNode) } - def copy(flags: T.unsafe(nil), filepath: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15646 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + keyword_loc: Prism::Location, + rescue_expression: Prism::Node + ).returns(Prism::RescueModifierNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18226 + # source://prism//lib/prism/node.rb#15631 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, filepath: String, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node, keyword_loc: Location, rescue_expression: Prism::node } # - # source://prism//lib/prism/node.rb#18249 + # source://prism//lib/prism/node.rb#15654 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # attr_reader expression: Prism::node + # + # source://prism//lib/prism/node.rb#15659 + sig { returns(Prism::Node) } + def expression; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs. + # def inspect -> String # - # source://prism//lib/prism/node.rb#18258 - sig { returns(String) } - def filepath; end + # source://prism//lib/prism/node.rb#15683 + sig { override.returns(String) } + def inspect; end - # def forced_binary_encoding?: () -> bool - # - # @return [Boolean] + # def keyword: () -> String # - # source://prism//lib/prism/node.rb#18266 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end + # source://prism//lib/prism/node.rb#15678 + sig { returns(String) } + def keyword; end - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] + # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#18261 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end + # source://prism//lib/prism/node.rb#15662 + sig { returns(Prism::Location) } + def keyword_loc; end - # def frozen?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#18271 - sig { returns(T::Boolean) } - def frozen?; end + # source://prism//lib/prism/parse_result/newlines.rb#115 + def newline_flag!(lines); end - # def inspect(NodeInspector inspector) -> String + # attr_reader rescue_expression: Prism::node # - # source://prism//lib/prism/node.rb#18281 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15675 + sig { returns(Prism::Node) } + def rescue_expression; end - # def mutable?: () -> bool - # - # @return [Boolean] + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node.rb#18276 - sig { returns(T::Boolean) } - def mutable?; end + # source://prism//lib/prism/node.rb#15670 + def save_keyword_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18303 + # source://prism//lib/prism/node.rb#15688 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#18254 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#18313 + # source://prism//lib/prism/node.rb#15693 def type; end end end -# Represents the use of the `__LINE__` keyword. +# Represents a rescue statement. # -# __LINE__ -# ^^^^^^^^ +# begin +# rescue Foo, *splat, Bar => ex +# foo +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# end # -# source://prism//lib/prism/node.rb#18330 -class Prism::SourceLineNode < ::Prism::Node - # def initialize: (Location location) -> void +# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field. +# +# source://prism//lib/prism/node.rb#15716 +class Prism::RescueNode < ::Prism::Node + # Initialize a new RescueNode node. # - # @return [SourceLineNode] a new instance of SourceLineNode + # @return [RescueNode] a new instance of RescueNode # - # source://prism//lib/prism/node.rb#18332 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#15718 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + exceptions: T::Array[Prism::Node], + operator_loc: T.nilable(Prism::Location), + reference: T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)), + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(Prism::RescueNode) + ).void + end + def initialize(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18407 + # source://prism//lib/prism/node.rb#15865 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18339 + # source://prism//lib/prism/node.rb#15733 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18344 + # source://prism//lib/prism/node.rb#15738 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18354 + # source://prism//lib/prism/node.rb#15753 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18349 + # source://prism//lib/prism/node.rb#15743 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> SourceLineNode + # Returns the subsequent rescue clause of the rescue node. This method is + # deprecated in favor of #subsequent. # - # source://prism//lib/prism/node.rb#18359 - sig { params(location: Prism::Location).returns(Prism::SourceLineNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node_ext.rb#494 + def consequent; end - # def child_nodes: () -> Array[nil | Node] + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode + # + # source://prism//lib/prism/node.rb#15758 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + exceptions: T::Array[Prism::Node], + operator_loc: T.nilable(Prism::Location), + reference: T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)), + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(Prism::RescueNode) + ).returns(Prism::RescueNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil)); end + + # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18344 + # source://prism//lib/prism/node.rb#15738 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, exceptions: Array[Prism::node], operator_loc: Location?, reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, then_keyword_loc: Location?, statements: StatementsNode?, subsequent: RescueNode? } # - # source://prism//lib/prism/node.rb#18367 + # source://prism//lib/prism/node.rb#15766 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # attr_reader exceptions: Array[Prism::node] + # + # source://prism//lib/prism/node.rb#15784 + sig { returns(T::Array[Prism::Node]) } + def exceptions; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#18372 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15849 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # def keyword: () -> String # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#15834 + sig { returns(String) } + def keyword; end + + # attr_reader keyword_loc: Location # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#15771 + sig { returns(Prism::Location) } + def keyword_loc; end + + # def operator: () -> String? # - # source://prism//lib/prism/node.rb#18391 + # source://prism//lib/prism/node.rb#15839 + sig { returns(T.nilable(String)) } + def operator; end + + # attr_reader operator_loc: Location? + # + # source://prism//lib/prism/node.rb#15787 + sig { returns(T.nilable(Prism::Location)) } + def operator_loc; end + + # attr_reader reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil + # + # source://prism//lib/prism/node.rb#15806 + sig do + returns(T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode))) + end + def reference; end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15779 + def save_keyword_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15801 + def save_operator_loc(repository); end + + # Save the then_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15823 + def save_then_keyword_loc(repository); end + + # attr_reader statements: StatementsNode? + # + # source://prism//lib/prism/node.rb#15828 + sig { returns(T.nilable(Prism::StatementsNode)) } + def statements; end + + # attr_reader subsequent: RescueNode? + # + # source://prism//lib/prism/node.rb#15831 + sig { returns(T.nilable(Prism::RescueNode)) } + def subsequent; end + + # def then_keyword: () -> String? + # + # source://prism//lib/prism/node.rb#15844 + sig { returns(T.nilable(String)) } + def then_keyword; end + + # attr_reader then_keyword_loc: Location? + # + # source://prism//lib/prism/node.rb#15809 + sig { returns(T.nilable(Prism::Location)) } + def then_keyword_loc; end + + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#15854 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#18401 + # source://prism//lib/prism/node.rb#15859 def type; end end end -# Represents the use of the splat operator. +# Represents a rest parameter to a method, block, or lambda definition. # -# [*a] -# ^^ +# def a(*b) +# ^^ +# end # -# source://prism//lib/prism/node.rb#18416 -class Prism::SplatNode < ::Prism::Node - # def initialize: (Location operator_loc, Prism::node? expression, Location location) -> void +# source://prism//lib/prism/node.rb#15883 +class Prism::RestParameterNode < ::Prism::Node + # Initialize a new RestParameterNode node. # - # @return [SplatNode] a new instance of SplatNode + # @return [RestParameterNode] a new instance of RestParameterNode # - # source://prism//lib/prism/node.rb#18418 + # source://prism//lib/prism/node.rb#15885 sig do params( source: Prism::Source, - operator_loc: Prism::Location, - expression: T.nilable(Prism::Node), - location: Prism::Location + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location ).void end - def initialize(source, operator_loc, expression, location); end + def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18519 + # source://prism//lib/prism/node.rb#15990 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18427 + # source://prism//lib/prism/node.rb#15896 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18432 + # source://prism//lib/prism/node.rb#15901 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18444 + # source://prism//lib/prism/node.rb#15911 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18437 + # source://prism//lib/prism/node.rb#15906 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?operator_loc: Location, ?expression: Prism::node?, ?location: Location) -> SplatNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode # - # source://prism//lib/prism/node.rb#18449 + # source://prism//lib/prism/node.rb#15916 sig do params( - operator_loc: Prism::Location, - expression: T.nilable(Prism::Node), - location: Prism::Location - ).returns(Prism::SplatNode) + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: T.nilable(Symbol), + name_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location + ).returns(Prism::RestParameterNode) end - def copy(operator_loc: T.unsafe(nil), expression: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18432 + # source://prism//lib/prism/node.rb#15901 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { operator_loc: Location, expression: Prism::node?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol?, name_loc: Location?, operator_loc: Location } # - # source://prism//lib/prism/node.rb#18457 + # source://prism//lib/prism/node.rb#15924 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - # attr_reader expression: Prism::node? - # - # source://prism//lib/prism/node.rb#18469 - sig { returns(T.nilable(Prism::Node)) } - def expression; end - sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String + # + # source://prism//lib/prism/node.rb#15974 + sig { override.returns(String) } + def inspect; end + + # attr_reader name: Symbol? + # + # source://prism//lib/prism/node.rb#15934 + sig { returns(T.nilable(Symbol)) } + def name; end + + # attr_reader name_loc: Location? # - # source://prism//lib/prism/node.rb#18477 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#15937 + sig { returns(T.nilable(Prism::Location)) } + def name_loc; end # def operator: () -> String # - # source://prism//lib/prism/node.rb#18472 + # source://prism//lib/prism/node.rb#15969 sig { returns(String) } def operator; end # attr_reader operator_loc: Location # - # source://prism//lib/prism/node.rb#18462 + # source://prism//lib/prism/node.rb#15956 sig { returns(Prism::Location) } def operator_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # def repeated_parameter?: () -> bool # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # @return [Boolean] # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#15929 + sig { returns(T::Boolean) } + def repeated_parameter?; end + + # Save the name_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15951 + def save_name_loc(repository); end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#15964 + def save_operator_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18503 + # source://prism//lib/prism/node.rb#15979 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#18513 + # source://prism//lib/prism/node.rb#15984 def type; end end end -# Represents a set of statements contained within some scope. +# This represents the result of a call to ::parse or ::parse_file. It contains +# the requested structure, any comments that were encounters, and any errors +# that were encountered. # -# foo; bar; baz -# ^^^^^^^^^^^^^ +# source://prism//lib/prism/parse_result.rb#679 +class Prism::Result + # Create a new result object with the given values. + # + # @return [Result] a new instance of Result + # + # source://prism//lib/prism/parse_result.rb#701 + sig do + params( + comments: T::Array[Prism::Comment], + magic_comments: T::Array[Prism::MagicComment], + data_loc: T.nilable(Prism::Location), + errors: T::Array[Prism::ParseError], + warnings: T::Array[Prism::ParseWarning], + source: Prism::Source + ).void + end + def initialize(comments, magic_comments, data_loc, errors, warnings, source); end + + # Create a code units cache for the given encoding. + # + # source://prism//lib/prism/parse_result.rb#733 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) + end + def code_units_cache(encoding); end + + # The list of comments that were encountered during parsing. + # + # source://prism//lib/prism/parse_result.rb#681 + sig { returns(T::Array[Prism::Comment]) } + def comments; end + + # An optional location that represents the location of the __END__ marker + # and the rest of the content of the file. This content is loaded into the + # DATA constant when the file being parsed is the main file being executed. + # + # source://prism//lib/prism/parse_result.rb#689 + sig { returns(T.nilable(Prism::Location)) } + def data_loc; end + + # Implement the hash pattern matching interface for Result. + # + # source://prism//lib/prism/parse_result.rb#711 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end + + # Returns the encoding of the source code that was parsed. + # + # source://prism//lib/prism/parse_result.rb#716 + sig { returns(Encoding) } + def encoding; end + + # The list of errors that were generated during parsing. + # + # source://prism//lib/prism/parse_result.rb#692 + sig { returns(T::Array[Prism::ParseError]) } + def errors; end + + # Returns true if there were errors during parsing and false if there were + # not. + # + # @return [Boolean] + # + # source://prism//lib/prism/parse_result.rb#728 + sig { returns(T::Boolean) } + def failure?; end + + # The list of magic comments that were encountered during parsing. + # + # source://prism//lib/prism/parse_result.rb#684 + sig { returns(T::Array[Prism::MagicComment]) } + def magic_comments; end + + # A Source instance that represents the source code that was parsed. + # + # source://prism//lib/prism/parse_result.rb#698 + sig { returns(Prism::Source) } + def source; end + + # Returns true if there were no errors during parsing and false if there + # were. + # + # @return [Boolean] + # + # source://prism//lib/prism/parse_result.rb#722 + sig { returns(T::Boolean) } + def success?; end + + # The list of warnings that were generated during parsing. + # + # source://prism//lib/prism/parse_result.rb#695 + sig { returns(T::Array[Prism::ParseWarning]) } + def warnings; end +end + +# Represents the use of the `retry` keyword. # -# source://prism//lib/prism/node.rb#18530 -class Prism::StatementsNode < ::Prism::Node - # def initialize: (Array[Prism::node] body, Location location) -> void +# retry +# ^^^^^ +# +# source://prism//lib/prism/node.rb#16003 +class Prism::RetryNode < ::Prism::Node + # Initialize a new RetryNode node. # - # @return [StatementsNode] a new instance of StatementsNode + # @return [RetryNode] a new instance of RetryNode # - # source://prism//lib/prism/node.rb#18532 - sig { params(source: Prism::Source, body: T::Array[Prism::Node], location: Prism::Location).void } - def initialize(source, body, location); end + # source://prism//lib/prism/node.rb#16005 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18612 + # source://prism//lib/prism/node.rb#16062 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18540 + # source://prism//lib/prism/node.rb#16013 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader body: Array[Prism::node] - # - # source://prism//lib/prism/node.rb#18573 - sig { returns(T::Array[Prism::Node]) } - def body; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18545 + # source://prism//lib/prism/node.rb#16018 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18555 + # source://prism//lib/prism/node.rb#16028 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18550 + # source://prism//lib/prism/node.rb#16023 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?body: Array[Prism::node], ?location: Location) -> StatementsNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RetryNode # - # source://prism//lib/prism/node.rb#18560 - sig { params(body: T::Array[Prism::Node], location: Prism::Location).returns(Prism::StatementsNode) } - def copy(body: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16033 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::RetryNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18545 + # source://prism//lib/prism/node.rb#16018 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { body: Array[Prism::node], location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#18568 + # source://prism//lib/prism/node.rb#16041 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#18576 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16046 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18596 + # source://prism//lib/prism/node.rb#16051 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#18606 + # source://prism//lib/prism/node.rb#16056 def type; end end end -# Flags for string nodes. -# -# source://prism//lib/prism/node.rb#20469 -module Prism::StringFlags; end - -# internal bytes forced the encoding to binary -# -# source://prism//lib/prism/node.rb#20474 -Prism::StringFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) - -# internal bytes forced the encoding to UTF-8 -# -# source://prism//lib/prism/node.rb#20471 -Prism::StringFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) - -# source://prism//lib/prism/node.rb#20477 -Prism::StringFlags::FROZEN = T.let(T.unsafe(nil), Integer) - -# source://prism//lib/prism/node.rb#20480 -Prism::StringFlags::MUTABLE = T.let(T.unsafe(nil), Integer) - -# Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string. -# -# "foo" -# ^^^^^ -# -# %w[foo] -# ^^^ +# Represents the use of the `return` keyword. # -# "foo #{bar} baz" -# ^^^^ ^^^^ +# return 1 +# ^^^^^^^^ # -# source://prism//lib/prism/node.rb#18629 -class Prism::StringNode < ::Prism::Node - include ::Prism::HeredocQuery - - # def initialize: (Integer flags, Location? opening_loc, Location content_loc, Location? closing_loc, String unescaped, Location location) -> void +# source://prism//lib/prism/node.rb#16071 +class Prism::ReturnNode < ::Prism::Node + # Initialize a new ReturnNode node. # - # @return [StringNode] a new instance of StringNode + # @return [ReturnNode] a new instance of ReturnNode # - # source://prism//lib/prism/node.rb#18631 + # source://prism//lib/prism/node.rb#16073 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - content_loc: Prism::Location, - closing_loc: T.nilable(Prism::Location), - unescaped: String, - location: Prism::Location + keyword_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode) ).void end - def initialize(source, flags, opening_loc, content_loc, closing_loc, unescaped, location); end + def initialize(source, node_id, location, flags, keyword_loc, arguments); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18792 + # source://prism//lib/prism/node.rb#16155 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18643 + # source://prism//lib/prism/node.rb#16083 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end + # attr_reader arguments: ArgumentsNode? + # + # source://prism//lib/prism/node.rb#16131 + sig { returns(T.nilable(Prism::ArgumentsNode)) } + def arguments; end + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18648 + # source://prism//lib/prism/node.rb#16088 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String? - # - # source://prism//lib/prism/node.rb#18746 - sig { returns(T.nilable(String)) } - def closing; end - - # attr_reader closing_loc: Location? - # - # source://prism//lib/prism/node.rb#18700 - sig { returns(T.nilable(Prism::Location)) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18658 + # source://prism//lib/prism/node.rb#16100 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18653 + # source://prism//lib/prism/node.rb#16093 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def content: () -> String - # - # source://prism//lib/prism/node.rb#18741 - sig { returns(String) } - def content; end - - # attr_reader content_loc: Location - # - # source://prism//lib/prism/node.rb#18693 - sig { returns(Prism::Location) } - def content_loc; end - - # def copy: (?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String, ?location: Location) -> StringNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode # - # source://prism//lib/prism/node.rb#18663 + # source://prism//lib/prism/node.rb#16105 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - content_loc: Prism::Location, - closing_loc: T.nilable(Prism::Location), - unescaped: String, - location: Prism::Location - ).returns(Prism::StringNode) + keyword_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode) + ).returns(Prism::ReturnNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18648 + # source://prism//lib/prism/node.rb#16088 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location?, content_loc: Location, closing_loc: Location?, unescaped: String, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, arguments: ArgumentsNode? } # - # source://prism//lib/prism/node.rb#18671 + # source://prism//lib/prism/node.rb#16113 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def forced_binary_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#18721 - sig { returns(T::Boolean) } - def forced_binary_encoding?; end - - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#18716 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end - - # def frozen?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#18726 - sig { returns(T::Boolean) } - def frozen?; end - - sig { returns(T::Boolean) } - def heredoc?; end - - # def inspect(NodeInspector inspector) -> String - # - # source://prism//lib/prism/node.rb#18751 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end - - # def mutable?: () -> bool + # def inspect -> String # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#18731 - sig { returns(T::Boolean) } - def mutable?; end + # source://prism//lib/prism/node.rb#16139 + sig { override.returns(String) } + def inspect; end - # def opening: () -> String? + # def keyword: () -> String # - # source://prism//lib/prism/node.rb#18736 - sig { returns(T.nilable(String)) } - def opening; end + # source://prism//lib/prism/node.rb#16134 + sig { returns(String) } + def keyword; end - # attr_reader opening_loc: Location? + # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#18680 - sig { returns(T.nilable(Prism::Location)) } - def opening_loc; end + # source://prism//lib/prism/node.rb#16118 + sig { returns(Prism::Location) } + def keyword_loc; end - # Occasionally it's helpful to treat a string as if it were interpolated so - # that there's a consistent interface for working with strings. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/node_ext.rb#55 - sig { returns(Prism::InterpolatedStringNode) } - def to_interpolated; end + # source://prism//lib/prism/node.rb#16126 + def save_keyword_loc(repository); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18776 + # source://prism//lib/prism/node.rb#16144 sig { override.returns(Symbol) } def type; end - # attr_reader unescaped: String - # - # source://prism//lib/prism/node.rb#18713 - sig { returns(String) } - def unescaped; end - - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#18676 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#18786 + # source://prism//lib/prism/node.rb#16149 def type; end end end -# Represents the use of the `super` keyword with parentheses or arguments. +# This object is passed to the various Prism.* methods that accept the +# `scopes` option as an element of the list. It defines both the local +# variables visible at that scope as well as the forwarding parameters +# available at that scope. # -# super() -# ^^^^^^^ +# source://prism//lib/prism/parse_result.rb#887 +class Prism::Scope + # Create a new scope object with the given locals and forwarding. + # + # @return [Scope] a new instance of Scope + # + # source://prism//lib/prism/parse_result.rb#898 + sig { params(locals: T::Array[Symbol], forwarding: T::Array[Symbol]).void } + def initialize(locals, forwarding); end + + # The list of local variables that are forwarded to the next scope. This + # should by defined as an array of symbols containing the specific values of + # :*, :**, :&, or :"...". + # + # source://prism//lib/prism/parse_result.rb#895 + sig { returns(T::Array[Symbol]) } + def forwarding; end + + # The list of local variables that are defined in this scope. This should be + # defined as an array of symbols. + # + # source://prism//lib/prism/parse_result.rb#890 + sig { returns(T::Array[Symbol]) } + def locals; end +end + +# Represents the `self` keyword. # -# super foo, bar -# ^^^^^^^^^^^^^^ +# self +# ^^^^ # -# source://prism//lib/prism/node.rb#18809 -class Prism::SuperNode < ::Prism::Node - # def initialize: (Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, Prism::node? block, Location location) -> void +# source://prism//lib/prism/node.rb#16166 +class Prism::SelfNode < ::Prism::Node + # Initialize a new SelfNode node. # - # @return [SuperNode] a new instance of SuperNode + # @return [SelfNode] a new instance of SelfNode # - # source://prism//lib/prism/node.rb#18811 - sig do - params( - source: Prism::Source, - keyword_loc: Prism::Location, - lparen_loc: T.nilable(Prism::Location), - arguments: T.nilable(Prism::ArgumentsNode), - rparen_loc: T.nilable(Prism::Location), - block: T.nilable(Prism::Node), - location: Prism::Location - ).void - end - def initialize(source, keyword_loc, lparen_loc, arguments, rparen_loc, block, location); end + # source://prism//lib/prism/node.rb#16168 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#18963 + # source://prism//lib/prism/node.rb#16225 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18823 + # source://prism//lib/prism/node.rb#16176 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end - # attr_reader arguments: ArgumentsNode? - # - # source://prism//lib/prism/node.rb#18879 - sig { returns(T.nilable(Prism::ArgumentsNode)) } - def arguments; end - - # attr_reader block: Prism::node? - # - # source://prism//lib/prism/node.rb#18895 - sig { returns(T.nilable(Prism::Node)) } - def block; end - # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18828 + # source://prism//lib/prism/node.rb#16181 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#18841 + # source://prism//lib/prism/node.rb#16191 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#18833 + # source://prism//lib/prism/node.rb#16186 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: Prism::node?, ?location: Location) -> SuperNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SelfNode # - # source://prism//lib/prism/node.rb#18846 - sig do - params( - keyword_loc: Prism::Location, - lparen_loc: T.nilable(Prism::Location), - arguments: T.nilable(Prism::ArgumentsNode), - rparen_loc: T.nilable(Prism::Location), - block: T.nilable(Prism::Node), - location: Prism::Location - ).returns(Prism::SuperNode) - end - def copy(keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil), location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16196 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SelfNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18828 + # source://prism//lib/prism/node.rb#16181 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, block: Prism::node?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#18854 + # source://prism//lib/prism/node.rb#16204 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#18913 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16209 + sig { override.returns(String) } + def inspect; end - # def keyword: () -> String + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#18898 - sig { returns(String) } - def keyword; end + # source://prism//lib/prism/node.rb#16214 + sig { override.returns(Symbol) } + def type; end - # attr_reader keyword_loc: Location - # - # source://prism//lib/prism/node.rb#18859 - sig { returns(Prism::Location) } - def keyword_loc; end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16219 + def type; end + end +end - # def lparen: () -> String? - # - # source://prism//lib/prism/node.rb#18903 - sig { returns(T.nilable(String)) } - def lparen; end +# A module responsible for deserializing parse results. +# +# source://prism//lib/prism/serialize.rb#14 +module Prism::Serialize + class << self + # Deserialize the dumped output from a request to lex or lex_file. + # + # The formatting of the source of this method is purposeful to illustrate + # the structure of the serialized data. + # + # source://prism//lib/prism/serialize.rb#84 + def load_lex(input, serialized, freeze); end - # attr_reader lparen_loc: Location? - # - # source://prism//lib/prism/node.rb#18866 - sig { returns(T.nilable(Prism::Location)) } - def lparen_loc; end + # Deserialize the dumped output from a request to parse or parse_file. + # + # The formatting of the source of this method is purposeful to illustrate + # the structure of the serialized data. + # + # source://prism//lib/prism/serialize.rb#31 + def load_parse(input, serialized, freeze); end - # def rparen: () -> String? - # - # source://prism//lib/prism/node.rb#18908 - sig { returns(T.nilable(String)) } - def rparen; end + # Deserialize the dumped output from a request to parse_comments or + # parse_file_comments. + # + # The formatting of the source of this method is purposeful to illustrate + # the structure of the serialized data. + # + # source://prism//lib/prism/serialize.rb#128 + def load_parse_comments(input, serialized, freeze); end - # attr_reader rparen_loc: Location? + # Deserialize the dumped output from a request to parse_lex or + # parse_lex_file. + # + # The formatting of the source of this method is purposeful to illustrate + # the structure of the serialized data. + # + # source://prism//lib/prism/serialize.rb#150 + def load_parse_lex(input, serialized, freeze); end + end +end + +# source://prism//lib/prism/serialize.rb#199 +class Prism::Serialize::ConstantPool + # @return [ConstantPool] a new instance of ConstantPool # - # source://prism//lib/prism/node.rb#18882 - sig { returns(T.nilable(Prism::Location)) } - def rparen_loc; end + # source://prism//lib/prism/serialize.rb#202 + def initialize(input, serialized, base, size); end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # source://prism//lib/prism/serialize.rb#210 + def get(index, encoding); end + + # Returns the value of attribute size. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/serialize.rb#200 + def size; end +end + +# StringIO is synchronized and that adds a high overhead on TruffleRuby. +# +# source://prism//lib/prism/serialize.rb#253 +Prism::Serialize::FastStringIO = StringIO + +# source://prism//lib/prism/serialize.rb#256 +class Prism::Serialize::Loader + # @return [Loader] a new instance of Loader + # + # source://prism//lib/prism/serialize.rb#259 + def initialize(source, serialized); end + + # @return [Boolean] # - # def type: () -> Symbol + # source://prism//lib/prism/serialize.rb#267 + def eof?; end + + # Returns the value of attribute input. # - # source://prism//lib/prism/node.rb#18947 - sig { override.returns(Symbol) } - def type; end + # source://prism//lib/prism/serialize.rb#257 + def input; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#18957 - def type; end - end + # Returns the value of attribute io. + # + # source://prism//lib/prism/serialize.rb#257 + def io; end + + # source://prism//lib/prism/serialize.rb#301 + def load_comments(freeze); end + + # source://prism//lib/prism/serialize.rb#823 + def load_constant(constant_pool, encoding); end + + # source://prism//lib/prism/serialize.rb#272 + def load_constant_pool(constant_pool); end + + # source://prism//lib/prism/serialize.rb#774 + def load_double; end + + # source://prism//lib/prism/serialize.rb#789 + def load_embedded_string(encoding); end + + # source://prism//lib/prism/serialize.rb#289 + def load_encoding; end + + # source://prism//lib/prism/serialize.rb#659 + def load_error_level; end + + # source://prism//lib/prism/serialize.rb#674 + def load_errors(encoding, freeze); end + + # source://prism//lib/prism/serialize.rb#283 + def load_header; end + + # source://prism//lib/prism/serialize.rb#763 + def load_integer; end + + # source://prism//lib/prism/serialize.rb#295 + def load_line_offsets(freeze); end + + # source://prism//lib/prism/serialize.rb#810 + def load_location(freeze); end + + # source://prism//lib/prism/serialize.rb#804 + def load_location_object(freeze); end + + # source://prism//lib/prism/serialize.rb#318 + def load_magic_comments(freeze); end + + # source://prism//lib/prism/serialize.rb#834 + def load_node(constant_pool, encoding, freeze); end + + # source://prism//lib/prism/serialize.rb#828 + def load_optional_constant(constant_pool, encoding); end + + # source://prism//lib/prism/serialize.rb#815 + def load_optional_location(freeze); end + + # source://prism//lib/prism/serialize.rb#819 + def load_optional_location_object(freeze); end + + # source://prism//lib/prism/serialize.rb#782 + def load_optional_node(constant_pool, encoding, freeze); end + + # source://prism//lib/prism/serialize.rb#793 + def load_string(encoding); end + + # source://prism//lib/prism/serialize.rb#725 + def load_tokens; end + + # source://prism//lib/prism/serialize.rb#778 + def load_uint32; end + + # source://prism//lib/prism/serialize.rb#758 + def load_varsint; end + + # variable-length integer using https://en.wikipedia.org/wiki/LEB128 + # This is also what protobuf uses: https://protobuf.dev/programming-guides/encoding/#varints + # + # source://prism//lib/prism/serialize.rb#744 + def load_varuint; end + + # source://prism//lib/prism/serialize.rb#693 + def load_warning_level; end + + # source://prism//lib/prism/serialize.rb#706 + def load_warnings(encoding, freeze); end + + # Returns the value of attribute source. + # + # source://prism//lib/prism/serialize.rb#257 + def source; end end -# Flags for symbol nodes. -# -# source://prism//lib/prism/node.rb#20484 -module Prism::SymbolFlags; end +# source://prism//lib/prism/serialize.rb#335 +Prism::Serialize::Loader::DIAGNOSTIC_TYPES = T.let(T.unsafe(nil), Array) -# internal bytes forced the encoding to binary +# The major version of prism that we are expecting to find in the serialized +# strings. # -# source://prism//lib/prism/node.rb#20489 -Prism::SymbolFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/serialize.rb#17 +Prism::Serialize::MAJOR_VERSION = T.let(T.unsafe(nil), Integer) -# internal bytes forced the encoding to US-ASCII +# The minor version of prism that we are expecting to find in the serialized +# strings. # -# source://prism//lib/prism/node.rb#20492 -Prism::SymbolFlags::FORCED_US_ASCII_ENCODING = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/serialize.rb#21 +Prism::Serialize::MINOR_VERSION = T.let(T.unsafe(nil), Integer) -# internal bytes forced the encoding to UTF-8 +# The patch version of prism that we are expecting to find in the serialized +# strings. # -# source://prism//lib/prism/node.rb#20486 -Prism::SymbolFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) +# source://prism//lib/prism/serialize.rb#25 +Prism::Serialize::PATCH_VERSION = T.let(T.unsafe(nil), Integer) -# Represents a symbol literal or a symbol contained within a `%i` list. +# The token types that can be indexed by their enum values. # -# :foo -# ^^^^ +# source://prism//lib/prism/serialize.rb#2219 +Prism::Serialize::TOKEN_TYPES = T.let(T.unsafe(nil), Array) + +# This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified. # -# %i[foo] -# ^^^ +# C = { a: 1 } +# ^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#18980 -class Prism::SymbolNode < ::Prism::Node - # def initialize: (Integer flags, Location? opening_loc, Location? value_loc, Location? closing_loc, String unescaped, Location location) -> void +# source://prism//lib/prism/node.rb#16235 +class Prism::ShareableConstantNode < ::Prism::Node + # Initialize a new ShareableConstantNode node. # - # @return [SymbolNode] a new instance of SymbolNode + # @return [ShareableConstantNode] a new instance of ShareableConstantNode # - # source://prism//lib/prism/node.rb#18982 + # source://prism//lib/prism/node.rb#16237 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - value_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - unescaped: String, - location: Prism::Location + write: T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode) ).void end - def initialize(source, flags, opening_loc, value_loc, closing_loc, unescaped, location); end + def initialize(source, node_id, location, flags, write); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19144 + # source://prism//lib/prism/node.rb#16313 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#18994 + # source://prism//lib/prism/node.rb#16246 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18999 + # source://prism//lib/prism/node.rb#16251 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end - # def closing: () -> String? - # - # source://prism//lib/prism/node.rb#19098 - sig { returns(T.nilable(String)) } - def closing; end - - # attr_reader closing_loc: Location? - # - # source://prism//lib/prism/node.rb#19057 - sig { returns(T.nilable(Prism::Location)) } - def closing_loc; end - # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19009 + # source://prism//lib/prism/node.rb#16261 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19004 + # source://prism//lib/prism/node.rb#16256 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String, ?location: Location) -> SymbolNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode # - # source://prism//lib/prism/node.rb#19014 + # source://prism//lib/prism/node.rb#16266 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, - opening_loc: T.nilable(Prism::Location), - value_loc: T.nilable(Prism::Location), - closing_loc: T.nilable(Prism::Location), - unescaped: String, - location: Prism::Location - ).returns(Prism::SymbolNode) + write: T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode) + ).returns(Prism::ShareableConstantNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), value_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), write: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#18999 + # source://prism//lib/prism/node.rb#16251 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location?, value_loc: Location?, closing_loc: Location?, unescaped: String, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode } # - # source://prism//lib/prism/node.rb#19022 + # source://prism//lib/prism/node.rb#16274 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end - sig { override.returns(T::Array[Prism::Reflection::Field]) } - def fields; end - - # def forced_binary_encoding?: () -> bool + # def experimental_copy?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#19078 + # source://prism//lib/prism/node.rb#16289 sig { returns(T::Boolean) } - def forced_binary_encoding?; end + def experimental_copy?; end - # def forced_us_ascii_encoding?: () -> bool + # def experimental_everything?: () -> bool # # @return [Boolean] # - # source://prism//lib/prism/node.rb#19083 + # source://prism//lib/prism/node.rb#16284 sig { returns(T::Boolean) } - def forced_us_ascii_encoding?; end + def experimental_everything?; end - # def forced_utf8_encoding?: () -> bool - # - # @return [Boolean] - # - # source://prism//lib/prism/node.rb#19073 - sig { returns(T::Boolean) } - def forced_utf8_encoding?; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19103 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16297 + sig { override.returns(String) } + def inspect; end - # def opening: () -> String? + # def literal?: () -> bool # - # source://prism//lib/prism/node.rb#19088 - sig { returns(T.nilable(String)) } - def opening; end - - # attr_reader opening_loc: Location? + # @return [Boolean] # - # source://prism//lib/prism/node.rb#19031 - sig { returns(T.nilable(Prism::Location)) } - def opening_loc; end + # source://prism//lib/prism/node.rb#16279 + sig { returns(T::Boolean) } + def literal?; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19128 + # source://prism//lib/prism/node.rb#16302 sig { override.returns(Symbol) } def type; end - # attr_reader unescaped: String - # - # source://prism//lib/prism/node.rb#19070 - sig { returns(String) } - def unescaped; end - - # def value: () -> String? - # - # source://prism//lib/prism/node.rb#19093 - sig { returns(T.nilable(String)) } - def value; end - - # attr_reader value_loc: Location? - # - # source://prism//lib/prism/node.rb#19044 - sig { returns(T.nilable(Prism::Location)) } - def value_loc; end - - protected - - # protected attr_reader flags: Integer + # The constant write that should be modified with the shareability state. # - # source://prism//lib/prism/node.rb#19027 - sig { returns(Integer) } - def flags; end + # source://prism//lib/prism/node.rb#16294 + sig do + returns(T.any(Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode, Prism::ConstantPathWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode)) + end + def write; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#19138 + # source://prism//lib/prism/node.rb#16307 def type; end end end -# This represents a token from the Ruby source. +# Flags for shareable constant nodes. # -# source://prism//lib/prism/parse_result.rb#550 -class Prism::Token - # Create a new token object with the given type, value, and location. - # - # @return [Token] a new instance of Token - # - # source://prism//lib/prism/parse_result.rb#562 - sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void } - def initialize(source, type, value, location); end +# source://prism//lib/prism/node.rb#18597 +module Prism::ShareableConstantNodeFlags; end - # Returns true if the given other token is equal to this token. - # - # source://prism//lib/prism/parse_result.rb#597 - sig { params(other: T.untyped).returns(T::Boolean) } - def ==(other); end +# constant writes that should be modified with shareable constant value experimental copy +# +# source://prism//lib/prism/node.rb#18605 +Prism::ShareableConstantNodeFlags::EXPERIMENTAL_COPY = T.let(T.unsafe(nil), Integer) - # Implement the hash pattern matching interface for Token. - # - # source://prism//lib/prism/parse_result.rb#570 - sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } - def deconstruct_keys(keys); end +# constant writes that should be modified with shareable constant value experimental everything +# +# source://prism//lib/prism/node.rb#18602 +Prism::ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING = T.let(T.unsafe(nil), Integer) - # A Location object representing the location of this token in the source. - # - # source://prism//lib/prism/parse_result.rb#575 - sig { returns(Prism::Location) } - def location; end +# constant writes that should be modified with shareable constant value literal +# +# source://prism//lib/prism/node.rb#18599 +Prism::ShareableConstantNodeFlags::LITERAL = T.let(T.unsafe(nil), Integer) - # Implement the pretty print interface for Token. +# Represents a singleton class declaration involving the `class` keyword. +# +# class << self end +# ^^^^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#16324 +class Prism::SingletonClassNode < ::Prism::Node + # Initialize a new SingletonClassNode node. # - # source://prism//lib/prism/parse_result.rb#582 - sig { params(q: T.untyped).void } - def pretty_print(q); end - - # The type of token that this token is. + # @return [SingletonClassNode] a new instance of SingletonClassNode # - # source://prism//lib/prism/parse_result.rb#556 - sig { returns(Symbol) } - def type; end + # source://prism//lib/prism/node.rb#16326 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + operator_loc: Prism::Location, + expression: Prism::Node, + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location + ).void + end + def initialize(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc); end - # A byteslice of the source that this token represents. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/parse_result.rb#559 - sig { returns(String) } - def value; end - - private + # source://prism//lib/prism/node.rb#16455 + def ===(other); end - # The Source object that represents the source this token came from. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/parse_result.rb#552 - sig { returns(Prism::Source) } - def source; end -end - -# This module is responsible for converting the prism syntax tree into other -# syntax trees. -# -# source://prism//lib/prism/translation.rb#6 -module Prism::Translation; end + # source://prism//lib/prism/node.rb#16340 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end -# This class is the entry-point for converting a prism syntax tree into the -# whitequark/parser gem's syntax tree. It inherits from the base parser for -# the parser gem, and overrides the parse* methods to parse with prism and -# then translate. -# -# source://prism//lib/prism/translation/parser.rb#11 -class Prism::Translation::Parser < ::Parser::Base - # The default encoding for Ruby files is UTF-8. + # attr_reader body: StatementsNode | BeginNode | nil # - # source://prism//lib/prism/translation/parser.rb#36 - def default_encoding; end + # source://prism//lib/prism/node.rb#16408 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } + def body; end - # Parses a source buffer and returns the AST. + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser.rb#44 - def parse(source_buffer); end + # source://prism//lib/prism/node.rb#16345 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Parses a source buffer and returns the AST and the source code comments. + # def class_keyword: () -> String # - # source://prism//lib/prism/translation/parser.rb#57 - def parse_with_comments(source_buffer); end + # source://prism//lib/prism/node.rb#16424 + sig { returns(String) } + def class_keyword; end - # Parses a source buffer and returns the AST, the source code comments, - # and the tokens emitted by the lexer. + # attr_reader class_keyword_loc: Location # - # source://prism//lib/prism/translation/parser.rb#74 - def tokenize(source_buffer, recover = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#16379 + sig { returns(Prism::Location) } + def class_keyword_loc; end - # Since prism resolves num params for us, we don't need to support this - # kind of logic here. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser.rb#100 - def try_declare_numparam(node); end - - # source://prism//lib/prism/translation/parser.rb#31 - sig { overridable.returns(Integer) } - def version; end - - # source://prism//lib/prism/translation/parser.rb#40 - def yyerror; end - - private + # source://prism//lib/prism/node.rb#16358 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Build the parser gem AST from the prism AST. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser.rb#258 - def build_ast(program, offset_cache); end + # source://prism//lib/prism/node.rb#16350 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Build the parser gem comments from the prism comments. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location) -> SingletonClassNode # - # source://prism//lib/prism/translation/parser.rb#263 - def build_comments(comments, offset_cache); end + # source://prism//lib/prism/node.rb#16363 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + operator_loc: Prism::Location, + expression: Prism::Node, + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location + ).returns(Prism::SingletonClassNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end - # Prism deals with offsets in bytes, while the parser gem deals with - # offsets in characters. We need to handle this conversion in order to - # build the parser gem AST. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # If the bytesize of the source is the same as the length, then we can - # just use the offset directly. Otherwise, we build an array where the - # index is the byte offset and the value is the character offset. + # source://prism//lib/prism/node.rb#16345 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end + + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Prism::node, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location } # - # source://prism//lib/prism/translation/parser.rb#241 - def build_offset_cache(source); end + # source://prism//lib/prism/node.rb#16371 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Build a range from a prism location. + # def end_keyword: () -> String # - # source://prism//lib/prism/translation/parser.rb#275 - def build_range(location, offset_cache); end + # source://prism//lib/prism/node.rb#16434 + sig { returns(String) } + def end_keyword; end - # Build the parser gem tokens from the prism tokens. + # attr_reader end_keyword_loc: Location # - # source://prism//lib/prism/translation/parser.rb#270 - def build_tokens(tokens, offset_cache); end + # source://prism//lib/prism/node.rb#16411 + sig { returns(Prism::Location) } + def end_keyword_loc; end - # Converts the version format handled by Parser to the format handled by Prism. + # attr_reader expression: Prism::node # - # source://prism//lib/prism/translation/parser.rb#284 - def convert_for_prism(version); end + # source://prism//lib/prism/node.rb#16405 + sig { returns(Prism::Node) } + def expression; end - # Build a diagnostic from the given prism parse error. + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/translation/parser.rb#119 - def error_diagnostic(error, offset_cache); end + # source://prism//lib/prism/node.rb#16439 + sig { override.returns(String) } + def inspect; end - # If there was a error generated during the parse, then raise an - # appropriate syntax error. Otherwise return the result. + # attr_reader locals: Array[Symbol] # - # source://prism//lib/prism/translation/parser.rb#219 - def unwrap(result, offset_cache); end + # source://prism//lib/prism/node.rb#16376 + sig { returns(T::Array[Symbol]) } + def locals; end - # This is a hook to allow consumers to disable some errors if they don't - # want them to block creating the syntax tree. + # def operator: () -> String # - # @return [Boolean] + # source://prism//lib/prism/node.rb#16429 + sig { returns(String) } + def operator; end + + # attr_reader operator_loc: Location # - # source://prism//lib/prism/translation/parser.rb#108 - def valid_error?(error); end + # source://prism//lib/prism/node.rb#16392 + sig { returns(Prism::Location) } + def operator_loc; end - # This is a hook to allow consumers to disable some warnings if they don't - # want them to block creating the syntax tree. + # Save the class_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # @return [Boolean] + # source://prism//lib/prism/node.rb#16387 + def save_class_keyword_loc(repository); end + + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser.rb#114 - def valid_warning?(warning); end + # source://prism//lib/prism/node.rb#16419 + def save_end_keyword_loc(repository); end - # Build a diagnostic from the given prism parse warning. + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser.rb#192 - def warning_diagnostic(warning, offset_cache); end -end + # source://prism//lib/prism/node.rb#16400 + def save_operator_loc(repository); end -# This class is the entry-point for Ruby 3.3 of `Prism::Translation::Parser`. -# -# source://prism//lib/prism/translation/parser33.rb#6 -class Prism::Translation::Parser33 < ::Prism::Translation::Parser - # source://prism//lib/prism/translation/parser33.rb#7 - sig { override.returns(Integer) } - def version; end -end + # Return a symbol representation of this node type. See `Node#type`. + # + # source://prism//lib/prism/node.rb#16444 + sig { override.returns(Symbol) } + def type; end -# This class is the entry-point for Ruby 3.4 of `Prism::Translation::Parser`. -# -# source://prism//lib/prism/translation/parser34.rb#6 -class Prism::Translation::Parser34 < ::Prism::Translation::Parser - # source://prism//lib/prism/translation/parser34.rb#7 - sig { override.returns(Integer) } - def version; end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16449 + def type; end + end end -# A visitor that knows how to convert a prism syntax tree into the -# whitequark/parser gem's syntax tree. +# This represents a source of Ruby code that has been parsed. It is used in +# conjunction with locations to allow them to resolve line numbers and source +# ranges. # -# source://prism//lib/prism/translation/parser/compiler.rb#8 -class Prism::Translation::Parser::Compiler < ::Prism::Compiler - Result = type_member { { fixed: Parser::AST::Node } } - - # Initialize a new compiler with the given parser, offset cache, and - # options. +# source://prism//lib/prism/parse_result.rb#7 +class Prism::Source + # Create a new source object with the given source code. # - # @return [Compiler] a new instance of Compiler + # @return [Source] a new instance of Source # - # source://prism//lib/prism/translation/parser/compiler.rb#39 - def initialize(parser, offset_cache, forwarding: T.unsafe(nil), in_destructure: T.unsafe(nil), in_pattern: T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#45 + sig { params(source: String, start_line: Integer, offsets: T::Array[Integer]).void } + def initialize(source, start_line = T.unsafe(nil), offsets = T.unsafe(nil)); end - # The Parser::Builders::Default instance that is being used to build the - # AST. + # Return the column number in characters for the given byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#18 - def builder; end + # source://prism//lib/prism/parse_result.rb#107 + sig { params(byte_offset: Integer).returns(Integer) } + def character_column(byte_offset); end - # The types of values that can be forwarded in the current scope. + # Return the character offset for the given byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#29 - def forwarding; end + # source://prism//lib/prism/parse_result.rb#102 + sig { params(byte_offset: Integer).returns(Integer) } + def character_offset(byte_offset); end - # Whether or not the current node is in a destructure. + # Generate a cache that targets a specific encoding for calculating code + # unit offsets. # - # source://prism//lib/prism/translation/parser/compiler.rb#32 - def in_destructure; end + # source://prism//lib/prism/parse_result.rb#135 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) + end + def code_units_cache(encoding); end - # Whether or not the current node is in a pattern. + # Returns the column number in code units for the given encoding for the + # given byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#35 - def in_pattern; end + # source://prism//lib/prism/parse_result.rb#141 + sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } + def code_units_column(byte_offset, encoding); end - # The offset cache that is used to map between byte and character - # offsets in the file. + # Returns the offset from the start of the file for the given byte offset + # counting in code units for the given encoding. # - # source://prism//lib/prism/translation/parser/compiler.rb#26 - def offset_cache; end - - # The Parser::Base instance that is being used to build the AST. + # This method is tested with UTF-8, UTF-16, and UTF-32. If there is the + # concept of code units that differs from the number of characters in other + # encodings, it is not captured here. # - # source://prism//lib/prism/translation/parser/compiler.rb#14 - def parser; end + # We purposefully replace invalid and undefined characters with replacement + # characters in this conversion. This happens for two reasons. First, it's + # possible that the given byte offset will not occur on a character + # boundary. Second, it's possible that the source code will contain a + # character that has no equivalent in the given encoding. + # + # source://prism//lib/prism/parse_result.rb#123 + sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } + def code_units_offset(byte_offset, encoding); end - # The Parser::Source::Buffer instance that is holding a reference to the - # source code. + # Return the column number for the given byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#22 - def source_buffer; end + # source://prism//lib/prism/parse_result.rb#97 + sig { params(byte_offset: Integer).returns(Integer) } + def column(byte_offset); end - # alias $foo $bar - # ^^^^^^^^^^^^^^^ + # Freeze this object and the objects it contains. # - # source://prism//lib/prism/translation/parser/compiler.rb#58 - def visit_alias_global_variable_node(node); end - - # alias foo bar - # ^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#52 - def visit_alias_method_node(node); end + # source://prism//lib/prism/parse_result.rb#146 + def deep_freeze; end - # foo => bar | baz - # ^^^^^^^^^ + # Returns the encoding of the source code, which is set by parameters to the + # parser or by the encoding magic comment. # - # source://prism//lib/prism/translation/parser/compiler.rb#64 - def visit_alternation_pattern_node(node); end + # source://prism//lib/prism/parse_result.rb#63 + sig { returns(Encoding) } + def encoding; end - # a and b - # ^^^^^^^ + # Binary search through the offsets to find the line number for the given + # byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#70 - def visit_and_node(node); end + # source://prism//lib/prism/parse_result.rb#80 + sig { params(byte_offset: Integer).returns(Integer) } + def line(byte_offset); end - # foo(bar) - # ^^^ + # Returns the byte offset of the end of the line corresponding to the given + # byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#101 - def visit_arguments_node(node); end + # source://prism//lib/prism/parse_result.rb#92 + def line_end(byte_offset); end - # [] - # ^^ + # Return the byte offset of the start of the line corresponding to the given + # byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#76 - def visit_array_node(node); end + # source://prism//lib/prism/parse_result.rb#86 + sig { params(byte_offset: Integer).returns(Integer) } + def line_start(byte_offset); end - # foo => [bar] - # ^^^^^ + # Returns the lines of the source code as an array of strings. # - # source://prism//lib/prism/translation/parser/compiler.rb#82 - def visit_array_pattern_node(node); end + # source://prism//lib/prism/parse_result.rb#68 + sig { returns(T::Array[String]) } + def lines; end - # { a: 1 } - # ^^^^ + # The list of newline byte offsets in the source code. # - # source://prism//lib/prism/translation/parser/compiler.rb#107 - def visit_assoc_node(node); end + # source://prism//lib/prism/parse_result.rb#42 + sig { returns(T::Array[Integer]) } + def offsets; end - # def foo(**); bar(**); end - # ^^ - # - # { **foo } - # ^^^^^ + # Replace the value of offsets with the given value. # - # source://prism//lib/prism/translation/parser/compiler.rb#148 - def visit_assoc_splat_node(node); end + # source://prism//lib/prism/parse_result.rb#57 + sig { params(offsets: T::Array[Integer]).void } + def replace_offsets(offsets); end - # $+ - # ^^ + # Replace the value of start_line with the given value. # - # source://prism//lib/prism/translation/parser/compiler.rb#158 - def visit_back_reference_read_node(node); end + # source://prism//lib/prism/parse_result.rb#52 + sig { params(start_line: Integer).void } + def replace_start_line(start_line); end - # begin end - # ^^^^^^^^^ + # Perform a byteslice on the source code using the given byte offset and + # byte length. # - # source://prism//lib/prism/translation/parser/compiler.rb#164 - def visit_begin_node(node); end + # source://prism//lib/prism/parse_result.rb#74 + sig { params(byte_offset: Integer, length: Integer).returns(String) } + def slice(byte_offset, length); end - # foo(&bar) - # ^^^^ + # The source code that this source object represents. # - # source://prism//lib/prism/translation/parser/compiler.rb#202 - def visit_block_argument_node(node); end + # source://prism//lib/prism/parse_result.rb#36 + sig { returns(String) } + def source; end - # foo { |; bar| } - # ^^^ + # The line number where this source starts. # - # source://prism//lib/prism/translation/parser/compiler.rb#208 - def visit_block_local_variable_node(node); end + # source://prism//lib/prism/parse_result.rb#39 + sig { returns(Integer) } + def start_line; end - # A block on a keyword or method call. - # - # @raise [CompilationError] - # - # source://prism//lib/prism/translation/parser/compiler.rb#213 - def visit_block_node(node); end + private - # def foo(&bar); end - # ^^^^ + # Binary search through the offsets to find the line number for the given + # byte offset. # - # source://prism//lib/prism/translation/parser/compiler.rb#219 - def visit_block_parameter_node(node); end + # source://prism//lib/prism/parse_result.rb#156 + def find_line(byte_offset); end - # A block's parameters. - # - # source://prism//lib/prism/translation/parser/compiler.rb#224 - def visit_block_parameters_node(node); end + class << self + # Create a new source object with the given source code. This method should + # be used instead of `new` and it will return either a `Source` or a + # specialized and more performant `ASCIISource` if no multibyte characters + # are present in the source code. + # + # source://prism//lib/prism/parse_result.rb#12 + def for(source, start_line = T.unsafe(nil), offsets = T.unsafe(nil)); end + end +end - # break - # ^^^^^ +# Represents the use of the `__ENCODING__` keyword. +# +# __ENCODING__ +# ^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#16471 +class Prism::SourceEncodingNode < ::Prism::Node + # Initialize a new SourceEncodingNode node. # - # break foo - # ^^^^^^^^^ + # @return [SourceEncodingNode] a new instance of SourceEncodingNode # - # source://prism//lib/prism/translation/parser/compiler.rb#233 - def visit_break_node(node); end + # source://prism//lib/prism/node.rb#16473 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end - # foo.bar += baz - # ^^^^^^^^^^^^^^^ - # foo.bar &&= baz - # ^^^^^^^^^^^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#319 - def visit_call_and_write_node(node); end + # source://prism//lib/prism/node.rb#16530 + def ===(other); end - # foo - # ^^^ - # - # foo.bar - # ^^^^^^^ - # - # foo.bar() {} - # ^^^^^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#245 - def visit_call_node(node); end + # source://prism//lib/prism/node.rb#16481 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # foo.bar += baz - # ^^^^^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#319 - def visit_call_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16486 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # foo.bar += baz - # ^^^^^^^^^^^^^^^ - # foo.bar ||= baz - # ^^^^^^^^^^^^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#319 - def visit_call_or_write_node(node); end + # source://prism//lib/prism/node.rb#16496 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # foo.bar, = 1 - # ^^^^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#346 - def visit_call_target_node(node); end + # source://prism//lib/prism/node.rb#16491 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # foo => bar => baz - # ^^^^^^^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode # - # source://prism//lib/prism/translation/parser/compiler.rb#358 - def visit_capture_pattern_node(node); end + # source://prism//lib/prism/node.rb#16501 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SourceEncodingNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # case foo; in bar; end - # ^^^^^^^^^^^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#377 - def visit_case_match_node(node); end + # source://prism//lib/prism/node.rb#16486 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # case foo; when bar; end - # ^^^^^^^^^^^^^^^^^^^^^^^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/translation/parser/compiler.rb#364 - def visit_case_node(node); end + # source://prism//lib/prism/node.rb#16509 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # class Foo; end - # ^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#390 - def visit_class_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # @@foo += bar - # ^^^^^^^^^^^^ - # @@foo &&= bar - # ^^^^^^^^^^^^^ + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#419 - def visit_class_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#16514 + sig { override.returns(String) } + def inspect; end - # @@foo += bar - # ^^^^^^^^^^^^ + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#419 - def visit_class_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16519 + sig { override.returns(Symbol) } + def type; end - # @@foo += bar - # ^^^^^^^^^^^^ - # @@foo ||= bar - # ^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#419 - def visit_class_variable_or_write_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16524 + def type; end + end +end - # @@foo - # ^^^^^ +# Represents the use of the `__FILE__` keyword. +# +# __FILE__ +# ^^^^^^^^ +# +# source://prism//lib/prism/node.rb#16539 +class Prism::SourceFileNode < ::Prism::Node + # Initialize a new SourceFileNode node. # - # source://prism//lib/prism/translation/parser/compiler.rb#403 - def visit_class_variable_read_node(node); end + # @return [SourceFileNode] a new instance of SourceFileNode + # + # source://prism//lib/prism/node.rb#16541 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + filepath: String + ).void + end + def initialize(source, node_id, location, flags, filepath); end - # @@foo, = bar - # ^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#437 - def visit_class_variable_target_node(node); end + # source://prism//lib/prism/node.rb#16622 + def ===(other); end - # @@foo = 1 - # ^^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#409 - def visit_class_variable_write_node(node); end + # source://prism//lib/prism/node.rb#16550 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Foo += bar - # ^^^^^^^^^^^ - # Foo &&= bar - # ^^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#458 - def visit_constant_and_write_node(node); end + # source://prism//lib/prism/node.rb#16555 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # Foo += bar - # ^^^^^^^^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#458 - def visit_constant_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16565 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Foo += bar - # ^^^^^^^^^^^ - # Foo ||= bar - # ^^^^^^^^^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#458 - def visit_constant_or_write_node(node); end + # source://prism//lib/prism/node.rb#16560 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Foo::Bar += baz - # ^^^^^^^^^^^^^^^ - # Foo::Bar &&= baz - # ^^^^^^^^^^^^^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?filepath: String) -> SourceFileNode # - # source://prism//lib/prism/translation/parser/compiler.rb#512 - def visit_constant_path_and_write_node(node); end + # source://prism//lib/prism/node.rb#16570 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + filepath: String + ).returns(Prism::SourceFileNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), filepath: T.unsafe(nil)); end - # Foo::Bar - # ^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#482 - def visit_constant_path_node(node); end + # source://prism//lib/prism/node.rb#16555 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Foo::Bar += baz - # ^^^^^^^^^^^^^^^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, filepath: String } # - # source://prism//lib/prism/translation/parser/compiler.rb#512 - def visit_constant_path_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16578 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # Foo::Bar += baz - # ^^^^^^^^^^^^^^^ - # Foo::Bar ||= baz - # ^^^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#512 - def visit_constant_path_or_write_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # Foo::Bar, = baz - # ^^^^^^^^ + # Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs. # - # source://prism//lib/prism/translation/parser/compiler.rb#530 - def visit_constant_path_target_node(node); end + # source://prism//lib/prism/node.rb#16603 + sig { returns(String) } + def filepath; end - # Foo::Bar = 1 - # ^^^^^^^^^^^^ + # def forced_binary_encoding?: () -> bool # - # Foo::Foo, Bar::Bar = 1 - # ^^^^^^^^ ^^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#502 - def visit_constant_path_write_node(node); end + # source://prism//lib/prism/node.rb#16588 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end - # Foo - # ^^^ + # def forced_utf8_encoding?: () -> bool # - # source://prism//lib/prism/translation/parser/compiler.rb#443 - def visit_constant_read_node(node); end - - # Foo, = bar - # ^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#476 - def visit_constant_target_node(node); end + # source://prism//lib/prism/node.rb#16583 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # Foo = 1 - # ^^^^^^^ + # def frozen?: () -> bool # - # Foo, Bar = 1 - # ^^^ ^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#452 - def visit_constant_write_node(node); end + # source://prism//lib/prism/node.rb#16593 + sig { returns(T::Boolean) } + def frozen?; end - # def foo; end - # ^^^^^^^^^^^^ + # def inspect -> String # - # def self.foo; end - # ^^^^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#539 - def visit_def_node(node); end + # source://prism//lib/prism/node.rb#16606 + sig { override.returns(String) } + def inspect; end - # defined? a - # ^^^^^^^^^^ + # def mutable?: () -> bool # - # defined?(a) - # ^^^^^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#586 - def visit_defined_node(node); end + # source://prism//lib/prism/node.rb#16598 + sig { returns(T::Boolean) } + def mutable?; end - # if foo then bar else baz end - # ^^^^^^^^^^^^ + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#598 - def visit_else_node(node); end + # source://prism//lib/prism/node.rb#16611 + sig { override.returns(Symbol) } + def type; end - # "foo #{bar}" - # ^^^^^^ + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16616 + def type; end + end +end + +# Represents the use of the `__LINE__` keyword. +# +# __LINE__ +# ^^^^^^^^ +# +# source://prism//lib/prism/node.rb#16633 +class Prism::SourceLineNode < ::Prism::Node + # Initialize a new SourceLineNode node. # - # source://prism//lib/prism/translation/parser/compiler.rb#604 - def visit_embedded_statements_node(node); end + # @return [SourceLineNode] a new instance of SourceLineNode + # + # source://prism//lib/prism/node.rb#16635 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end - # "foo #@bar" - # ^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#614 - def visit_embedded_variable_node(node); end + # source://prism//lib/prism/node.rb#16692 + def ===(other); end - # begin; foo; ensure; bar; end - # ^^^^^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # @raise [CompilationError] + # source://prism//lib/prism/node.rb#16643 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end + + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#620 - def visit_ensure_node(node); end + # source://prism//lib/prism/node.rb#16648 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # false - # ^^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#626 - def visit_false_node(node); end + # source://prism//lib/prism/node.rb#16658 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # foo => [*, bar, *] - # ^^^^^^^^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#632 - def visit_find_pattern_node(node); end + # source://prism//lib/prism/node.rb#16653 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # 0..5 - # ^^^^ - # if foo .. bar; end - # ^^^^^^^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceLineNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1364 - def visit_flip_flop_node(node); end + # source://prism//lib/prism/node.rb#16663 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SourceLineNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end - # 1.0 - # ^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#644 - def visit_float_node(node); end + # source://prism//lib/prism/node.rb#16648 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # for foo in bar do end - # ^^^^^^^^^^^^^^^^^^^^^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/translation/parser/compiler.rb#650 - def visit_for_node(node); end + # source://prism//lib/prism/node.rb#16671 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # def foo(...); bar(...); end - # ^^^ + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#668 - def visit_forwarding_arguments_node(node); end + # source://prism//lib/prism/node.rb#16676 + sig { override.returns(String) } + def inspect; end - # def foo(...); end - # ^^^ + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#674 - def visit_forwarding_parameter_node(node); end + # source://prism//lib/prism/node.rb#16681 + sig { override.returns(Symbol) } + def type; end - # super - # ^^^^^ + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16686 + def type; end + end +end + +# Represents the use of the splat operator. +# +# [*a] +# ^^ +# +# source://prism//lib/prism/node.rb#16701 +class Prism::SplatNode < ::Prism::Node + # Initialize a new SplatNode node. # - # super {} - # ^^^^^^^^ + # @return [SplatNode] a new instance of SplatNode # - # source://prism//lib/prism/translation/parser/compiler.rb#683 - def visit_forwarding_super_node(node); end + # source://prism//lib/prism/node.rb#16703 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + expression: T.nilable(Prism::Node) + ).void + end + def initialize(source, node_id, location, flags, operator_loc, expression); end - # $foo += bar - # ^^^^^^^^^^^ - # $foo &&= bar - # ^^^^^^^^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#711 - def visit_global_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#16785 + def ===(other); end - # $foo += bar - # ^^^^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#711 - def visit_global_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16713 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # $foo += bar - # ^^^^^^^^^^^ - # $foo ||= bar - # ^^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#711 - def visit_global_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#16718 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # $foo - # ^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#695 - def visit_global_variable_read_node(node); end + # source://prism//lib/prism/node.rb#16730 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # $foo, = bar - # ^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#729 - def visit_global_variable_target_node(node); end + # source://prism//lib/prism/node.rb#16723 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # $foo = 1 - # ^^^^^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode # - # source://prism//lib/prism/translation/parser/compiler.rb#701 - def visit_global_variable_write_node(node); end + # source://prism//lib/prism/node.rb#16735 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + expression: T.nilable(Prism::Node) + ).returns(Prism::SplatNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil)); end - # {} - # ^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#735 - def visit_hash_node(node); end + # source://prism//lib/prism/node.rb#16718 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # foo => {} - # ^^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, expression: Prism::node? } # - # source://prism//lib/prism/translation/parser/compiler.rb#745 - def visit_hash_pattern_node(node); end + # source://prism//lib/prism/node.rb#16743 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # if foo then bar end - # ^^^^^^^^^^^^^^^^^^^ - # - # bar if foo - # ^^^^^^^^^^ + # attr_reader expression: Prism::node? # - # foo ? bar : baz - # ^^^^^^^^^^^^^^^ + # source://prism//lib/prism/node.rb#16761 + sig { returns(T.nilable(Prism::Node)) } + def expression; end + + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end + + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#763 - def visit_if_node(node); end + # source://prism//lib/prism/node.rb#16769 + sig { override.returns(String) } + def inspect; end - # 1i - # ^^ + # def operator: () -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#805 - def visit_imaginary_node(node); end + # source://prism//lib/prism/node.rb#16764 + sig { returns(String) } + def operator; end - # { foo: } - # ^^^^ + # attr_reader operator_loc: Location # - # @raise [CompilationError] + # source://prism//lib/prism/node.rb#16748 + sig { returns(Prism::Location) } + def operator_loc; end + + # Save the operator_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#811 - def visit_implicit_node(node); end + # source://prism//lib/prism/node.rb#16756 + def save_operator_loc(repository); end - # foo { |bar,| } - # ^ + # Return a symbol representation of this node type. See `Node#type`. # - # @raise [CompilationError] - # - # source://prism//lib/prism/translation/parser/compiler.rb#817 - def visit_implicit_rest_node(node); end + # source://prism//lib/prism/node.rb#16774 + sig { override.returns(Symbol) } + def type; end - # case foo; in bar; end - # ^^^^^^^^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#823 - def visit_in_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16779 + def type; end + end +end - # foo[bar] += baz - # ^^^^^^^^^^^^^^^ - # foo[bar] &&= baz - # ^^^^^^^^^^^^^^^^ +# Represents a set of statements contained within some scope. +# +# foo; bar; baz +# ^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#16796 +class Prism::StatementsNode < ::Prism::Node + # Initialize a new StatementsNode node. # - # source://prism//lib/prism/translation/parser/compiler.rb#849 - def visit_index_and_write_node(node); end - - # foo[bar] += baz - # ^^^^^^^^^^^^^^^ + # @return [StatementsNode] a new instance of StatementsNode # - # source://prism//lib/prism/translation/parser/compiler.rb#849 - def visit_index_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16798 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T::Array[Prism::Node] + ).void + end + def initialize(source, node_id, location, flags, body); end - # foo[bar] += baz - # ^^^^^^^^^^^^^^^ - # foo[bar] ||= baz - # ^^^^^^^^^^^^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#849 - def visit_index_or_write_node(node); end + # source://prism//lib/prism/node.rb#16859 + def ===(other); end - # foo[bar], = 1 - # ^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#875 - def visit_index_target_node(node); end + # source://prism//lib/prism/node.rb#16807 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # ^^^^^^^^^^^ - # ^^^^^^^^^^^^ + # attr_reader body: Array[Prism::node] # - # source://prism//lib/prism/translation/parser/compiler.rb#902 - def visit_instance_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#16840 + sig { returns(T::Array[Prism::Node]) } + def body; end - # ^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#902 - def visit_instance_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16812 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # ^^^^^^^^^^^ - # ^^^^^^^^^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#902 - def visit_instance_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#16822 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # ^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#886 - def visit_instance_variable_read_node(node); end + # source://prism//lib/prism/node.rb#16817 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # @foo, = bar - # ^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) -> StatementsNode # - # source://prism//lib/prism/translation/parser/compiler.rb#920 - def visit_instance_variable_target_node(node); end + # source://prism//lib/prism/node.rb#16827 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T::Array[Prism::Node] + ).returns(Prism::StatementsNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil)); end - # ^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#892 - def visit_instance_variable_write_node(node); end + # source://prism//lib/prism/node.rb#16812 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # 1 - # ^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, body: Array[Prism::node] } # - # source://prism//lib/prism/translation/parser/compiler.rb#926 - def visit_integer_node(node); end + # source://prism//lib/prism/node.rb#16835 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # /foo #{bar}/ - # ^^^^^^^^^^^^ - # if /foo #{bar}/ then end - # ^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#932 - def visit_interpolated_match_last_line_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # /foo #{bar}/ - # ^^^^^^^^^^^^ + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#932 - def visit_interpolated_regular_expression_node(node); end + # source://prism//lib/prism/node.rb#16843 + sig { override.returns(String) } + def inspect; end - # "foo #{bar}" - # ^^^^^^^^^^^^ + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#947 - def visit_interpolated_string_node(node); end + # source://prism//lib/prism/node.rb#16848 + sig { override.returns(Symbol) } + def type; end - # :"foo #{bar}" - # ^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1010 - def visit_interpolated_symbol_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#16853 + def type; end + end +end - # `foo #{bar}` - # ^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1020 - def visit_interpolated_x_string_node(node); end +# Flags for string nodes. +# +# source://prism//lib/prism/node.rb#18609 +module Prism::StringFlags; end - # -> { it } - # ^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1035 - def visit_it_parameters_node(node); end +# internal bytes forced the encoding to binary +# +# source://prism//lib/prism/node.rb#18614 +Prism::StringFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) - # foo(bar: baz) - # ^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1041 - def visit_keyword_hash_node(node); end +# internal bytes forced the encoding to UTF-8 +# +# source://prism//lib/prism/node.rb#18611 +Prism::StringFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) - # def foo(**bar); end - # ^^^^^ +# source://prism//lib/prism/node.rb#18617 +Prism::StringFlags::FROZEN = T.let(T.unsafe(nil), Integer) + +# source://prism//lib/prism/node.rb#18620 +Prism::StringFlags::MUTABLE = T.let(T.unsafe(nil), Integer) + +# Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string. +# +# "foo" +# ^^^^^ +# +# %w[foo] +# ^^^ +# +# "foo #{bar} baz" +# ^^^^ ^^^^ +# +# source://prism//lib/prism/node.rb#16876 +class Prism::StringNode < ::Prism::Node + include ::Prism::HeredocQuery + + # Initialize a new StringNode node. # - # def foo(**); end - # ^^ + # @return [StringNode] a new instance of StringNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1050 - def visit_keyword_rest_parameter_node(node); end + # source://prism//lib/prism/node.rb#16878 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + content_loc: Prism::Location, + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).void + end + def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end - # -> {} - # ^^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#1059 - def visit_lambda_node(node); end + # source://prism//lib/prism/node.rb#17028 + def ===(other); end - # foo += bar - # ^^^^^^^^^^ - # foo &&= bar - # ^^^^^^^^^^^ + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#1108 - def visit_local_variable_and_write_node(node); end + # source://prism//lib/prism/node.rb#16890 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # foo += bar - # ^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1108 - def visit_local_variable_operator_write_node(node); end + # source://prism//lib/prism/node.rb#16895 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # foo += bar - # ^^^^^^^^^^ - # foo ||= bar - # ^^^^^^^^^^^ + # def closing: () -> String? # - # source://prism//lib/prism/translation/parser/compiler.rb#1108 - def visit_local_variable_or_write_node(node); end + # source://prism//lib/prism/node.rb#17007 + sig { returns(T.nilable(String)) } + def closing; end - # foo - # ^^^ + # attr_reader closing_loc: Location? # - # source://prism//lib/prism/translation/parser/compiler.rb#1085 - def visit_local_variable_read_node(node); end + # source://prism//lib/prism/node.rb#16975 + sig { returns(T.nilable(Prism::Location)) } + def closing_loc; end - # foo, = bar - # ^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#1126 - def visit_local_variable_target_node(node); end + # source://prism//lib/prism/node.rb#16905 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # foo = 1 - # ^^^^^^^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1098 - def visit_local_variable_write_node(node); end + # source://prism//lib/prism/node.rb#16900 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # /foo/ - # ^^^^^ - # if /foo/ then end - # ^^^^^ + # def content: () -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#1398 - def visit_match_last_line_node(node); end + # source://prism//lib/prism/node.rb#17002 + sig { returns(String) } + def content; end - # foo in bar - # ^^^^^^^^^^ + # attr_reader content_loc: Location # - # source://prism//lib/prism/translation/parser/compiler.rb#1136 - def visit_match_predicate_node(node); end + # source://prism//lib/prism/node.rb#16962 + sig { returns(Prism::Location) } + def content_loc; end - # foo => bar - # ^^^^^^^^^^ + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1146 - def visit_match_required_node(node); end + # source://prism//lib/prism/node.rb#16910 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + content_loc: Prism::Location, + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).returns(Prism::StringNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end - # /(?foo)/ =~ bar - # ^^^^^^^^^^^^^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1156 - def visit_match_write_node(node); end + # source://prism//lib/prism/node.rb#16895 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # A node that is missing from the syntax tree. This is only used in the - # case of a syntax error. The parser gem doesn't have such a concept, so - # we invent our own here. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, content_loc: Location, closing_loc: Location?, unescaped: String } # - # source://prism//lib/prism/translation/parser/compiler.rb#1167 - def visit_missing_node(node); end + # source://prism//lib/prism/node.rb#16918 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # module Foo; end - # ^^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1173 - def visit_module_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # foo, bar = baz - # ^^^^^^^^ + # def forced_binary_encoding?: () -> bool # - # source://prism//lib/prism/translation/parser/compiler.rb#1184 - def visit_multi_target_node(node); end - - # foo, bar = baz - # ^^^^^^^^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1198 - def visit_multi_write_node(node); end + # source://prism//lib/prism/node.rb#16928 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end - # next - # ^^^^ + # def forced_utf8_encoding?: () -> bool # - # next foo - # ^^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1219 - def visit_next_node(node); end + # source://prism//lib/prism/node.rb#16923 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # nil - # ^^^ + # def frozen?: () -> bool # - # source://prism//lib/prism/translation/parser/compiler.rb#1231 - def visit_nil_node(node); end - - # def foo(**nil); end - # ^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1237 - def visit_no_keywords_parameter_node(node); end + # source://prism//lib/prism/node.rb#16933 + sig { returns(T::Boolean) } + def frozen?; end - # -> { _1 + _2 } - # ^^^^^^^^^^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1247 - def visit_numbered_parameters_node(node); end + sig { returns(T::Boolean) } + def heredoc?; end - # $1 - # ^^ + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#1253 - def visit_numbered_reference_read_node(node); end + # source://prism//lib/prism/node.rb#17012 + sig { override.returns(String) } + def inspect; end - # def foo(bar: baz); end - # ^^^^^^^^ + # def mutable?: () -> bool # - # source://prism//lib/prism/translation/parser/compiler.rb#1259 - def visit_optional_keyword_parameter_node(node); end - - # def foo(bar = 1); end - # ^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1265 - def visit_optional_parameter_node(node); end + # source://prism//lib/prism/node.rb#16938 + sig { returns(T::Boolean) } + def mutable?; end - # a or b - # ^^^^^^ + # def opening: () -> String? # - # source://prism//lib/prism/translation/parser/compiler.rb#1271 - def visit_or_node(node); end + # source://prism//lib/prism/node.rb#16997 + sig { returns(T.nilable(String)) } + def opening; end - # def foo(bar, *baz); end - # ^^^^^^^^^ + # attr_reader opening_loc: Location? # - # source://prism//lib/prism/translation/parser/compiler.rb#1277 - def visit_parameters_node(node); end + # source://prism//lib/prism/node.rb#16943 + sig { returns(T.nilable(Prism::Location)) } + def opening_loc; end - # () - # ^^ - # - # (1) - # ^^^ + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#1316 - def visit_parentheses_node(node); end + # source://prism//lib/prism/node.rb#16989 + def save_closing_loc(repository); end - # foo => ^(bar) - # ^^^^^^ + # Save the content_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#1326 - def visit_pinned_expression_node(node); end + # source://prism//lib/prism/node.rb#16970 + def save_content_loc(repository); end - # foo = 1 and bar => ^foo - # ^^^^ + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#1333 - def visit_pinned_variable_node(node); end + # source://prism//lib/prism/node.rb#16957 + def save_opening_loc(repository); end - # END {} + # Occasionally it's helpful to treat a string as if it were interpolated so + # that there's a consistent interface for working with strings. # - # source://prism//lib/prism/translation/parser/compiler.rb#1338 - def visit_post_execution_node(node); end + # source://prism//lib/prism/node_ext.rb#72 + sig { returns(Prism::InterpolatedStringNode) } + def to_interpolated; end - # BEGIN {} + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#1348 - def visit_pre_execution_node(node); end + # source://prism//lib/prism/node.rb#17017 + sig { override.returns(Symbol) } + def type; end - # The top-level program node. + # attr_reader unescaped: String # - # source://prism//lib/prism/translation/parser/compiler.rb#1358 - def visit_program_node(node); end + # source://prism//lib/prism/node.rb#16994 + sig { returns(String) } + def unescaped; end - # 0..5 - # ^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1364 - def visit_range_node(node); end + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#17022 + def type; end + end +end - # 1r - # ^^ +# Query methods that allow categorizing strings based on their context for +# where they could be valid in a Ruby syntax tree. +# +# source://prism//lib/prism/string_query.rb#6 +class Prism::StringQuery + # Initialize a new query with the given string. # - # source://prism//lib/prism/translation/parser/compiler.rb#1386 - def visit_rational_node(node); end - - # redo - # ^^^^ + # @return [StringQuery] a new instance of StringQuery # - # source://prism//lib/prism/translation/parser/compiler.rb#1392 - def visit_redo_node(node); end + # source://prism//lib/prism/string_query.rb#11 + def initialize(string); end - # /foo/ - # ^^^^^ + # Whether or not this string is a valid constant name. # - # source://prism//lib/prism/translation/parser/compiler.rb#1398 - def visit_regular_expression_node(node); end - - # def foo(bar:); end - # ^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1413 - def visit_required_keyword_parameter_node(node); end + # source://prism//lib/prism/string_query.rb#21 + def constant?; end - # def foo(bar); end - # ^^^ + # Whether or not this string is a valid local variable name. # - # source://prism//lib/prism/translation/parser/compiler.rb#1419 - def visit_required_parameter_node(node); end - - # foo rescue bar - # ^^^^^^^^^^^^^^ + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1425 - def visit_rescue_modifier_node(node); end + # source://prism//lib/prism/string_query.rb#16 + def local?; end - # begin; rescue; end - # ^^^^^^^ + # Whether or not this string is a valid method name. # - # @raise [CompilationError] + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/compiler.rb#1443 - def visit_rescue_node(node); end + # source://prism//lib/prism/string_query.rb#26 + def method_name?; end - # def foo(*bar); end - # ^^^^ - # - # def foo(*); end - # ^ + # The string that this query is wrapping. # - # source://prism//lib/prism/translation/parser/compiler.rb#1452 - def visit_rest_parameter_node(node); end + # source://prism//lib/prism/string_query.rb#8 + def string; end - # retry - # ^^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1458 - def visit_retry_node(node); end + class << self + # Mirrors the C extension's StringQuery::constant? method. + # + # @return [Boolean] + def constant?(_arg0); end - # return - # ^^^^^^ + # Mirrors the C extension's StringQuery::local? method. + # + # @return [Boolean] + def local?(_arg0); end + + # Mirrors the C extension's StringQuery::method_name? method. + # + # @return [Boolean] + def method_name?(_arg0); end + end +end + +# Represents the use of the `super` keyword with parentheses or arguments. +# +# super() +# ^^^^^^^ +# +# super foo, bar +# ^^^^^^^^^^^^^^ +# +# source://prism//lib/prism/node.rb#17045 +class Prism::SuperNode < ::Prism::Node + # Initialize a new SuperNode node. # - # return 1 - # ^^^^^^^^ + # @return [SuperNode] a new instance of SuperNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1467 - def visit_return_node(node); end + # source://prism//lib/prism/node.rb#17047 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).void + end + def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block); end - # self - # ^^^^ + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#1479 - def visit_self_node(node); end + # source://prism//lib/prism/node.rb#17184 + def ===(other); end - # A shareable constant. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#1484 - def visit_shareable_constant_node(node); end + # source://prism//lib/prism/node.rb#17060 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # class << self; end - # ^^^^^^^^^^^^^^^^^^ + # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/translation/parser/compiler.rb#1490 - def visit_singleton_class_node(node); end + # source://prism//lib/prism/node.rb#17128 + sig { returns(T.nilable(Prism::ArgumentsNode)) } + def arguments; end - # __ENCODING__ - # ^^^^^^^^^^^^ + # attr_reader block: BlockNode | BlockArgumentNode | nil # - # source://prism//lib/prism/translation/parser/compiler.rb#1502 - def visit_source_encoding_node(node); end + # source://prism//lib/prism/node.rb#17150 + sig { returns(T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode))) } + def block; end - # __FILE__ - # ^^^^^^^^ + # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1508 - def visit_source_file_node(node); end + # source://prism//lib/prism/node.rb#17065 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end - # __LINE__ - # ^^^^^^^^ + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#1514 - def visit_source_line_node(node); end + # source://prism//lib/prism/node.rb#17078 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # foo(*bar) - # ^^^^ - # - # def foo((bar, *baz)); end - # ^^^^ - # - # def foo(*); bar(*); end - # ^ + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1526 - def visit_splat_node(node); end + # source://prism//lib/prism/node.rb#17070 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # A list of statements. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: BlockNode | BlockArgumentNode | nil) -> SuperNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1539 - def visit_statements_node(node); end + # source://prism//lib/prism/node.rb#17083 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).returns(Prism::SuperNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil)); end - # "foo" - # ^^^^^ + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1545 - def visit_string_node(node); end + # source://prism//lib/prism/node.rb#17065 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # super(foo) - # ^^^^^^^^^^ + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, block: BlockNode | BlockArgumentNode | nil } # - # source://prism//lib/prism/translation/parser/compiler.rb#1586 - def visit_super_node(node); end + # source://prism//lib/prism/node.rb#17091 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # :foo - # ^^^^ - # - # source://prism//lib/prism/translation/parser/compiler.rb#1609 - def visit_symbol_node(node); end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end - # true - # ^^^^ + # def inspect -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#1641 - def visit_true_node(node); end + # source://prism//lib/prism/node.rb#17168 + sig { override.returns(String) } + def inspect; end - # undef foo - # ^^^^^^^^^ + # def keyword: () -> String # - # source://prism//lib/prism/translation/parser/compiler.rb#1647 - def visit_undef_node(node); end + # source://prism//lib/prism/node.rb#17153 + sig { returns(String) } + def keyword; end - # unless foo; bar end - # ^^^^^^^^^^^^^^^^^^^ - # - # bar unless foo - # ^^^^^^^^^^^^^^ + # attr_reader keyword_loc: Location # - # source://prism//lib/prism/translation/parser/compiler.rb#1656 - def visit_unless_node(node); end + # source://prism//lib/prism/node.rb#17096 + sig { returns(Prism::Location) } + def keyword_loc; end - # until foo; bar end - # ^^^^^^^^^^^^^^^^^^ + # def lparen: () -> String? # - # bar until foo - # ^^^^^^^^^^^^^ + # source://prism//lib/prism/node.rb#17158 + sig { returns(T.nilable(String)) } + def lparen; end + + # attr_reader lparen_loc: Location? # - # source://prism//lib/prism/translation/parser/compiler.rb#1686 - def visit_until_node(node); end + # source://prism//lib/prism/node.rb#17109 + sig { returns(T.nilable(Prism::Location)) } + def lparen_loc; end - # case foo; when bar; end - # ^^^^^^^^^^^^^ + # def rparen: () -> String? # - # source://prism//lib/prism/translation/parser/compiler.rb#1708 - def visit_when_node(node); end + # source://prism//lib/prism/node.rb#17163 + sig { returns(T.nilable(String)) } + def rparen; end - # while foo; bar end - # ^^^^^^^^^^^^^^^^^^ + # attr_reader rparen_loc: Location? # - # bar while foo - # ^^^^^^^^^^^^^ + # source://prism//lib/prism/node.rb#17131 + sig { returns(T.nilable(Prism::Location)) } + def rparen_loc; end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#1726 - def visit_while_node(node); end + # source://prism//lib/prism/node.rb#17104 + def save_keyword_loc(repository); end - # `foo` - # ^^^^^ + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/compiler.rb#1748 - def visit_x_string_node(node); end + # source://prism//lib/prism/node.rb#17123 + def save_lparen_loc(repository); end - # yield - # ^^^^^ + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # yield 1 - # ^^^^^^^ + # source://prism//lib/prism/node.rb#17145 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/compiler.rb#1780 - def visit_yield_node(node); end + # source://prism//lib/prism/node.rb#17173 + sig { override.returns(Symbol) } + def type; end - private + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#17178 + def type; end + end +end - # Initialize a new compiler with the given option overrides, used to - # visit a subtree with the given options. - # - # source://prism//lib/prism/translation/parser/compiler.rb#1794 - def copy_compiler(forwarding: T.unsafe(nil), in_destructure: T.unsafe(nil), in_pattern: T.unsafe(nil)); end +# Flags for symbol nodes. +# +# source://prism//lib/prism/node.rb#18624 +module Prism::SymbolFlags; end - # When *, **, &, or ... are used as an argument in a method call, we - # check if they were allowed by the current context. To determine that - # we build this lookup table. - # - # source://prism//lib/prism/translation/parser/compiler.rb#1801 - def find_forwarding(node); end +# internal bytes forced the encoding to binary +# +# source://prism//lib/prism/node.rb#18629 +Prism::SymbolFlags::FORCED_BINARY_ENCODING = T.let(T.unsafe(nil), Integer) - # Because we have mutated the AST to allow for newlines in the middle of - # a rational, we need to manually handle the value here. - # - # source://prism//lib/prism/translation/parser/compiler.rb#1815 - def imaginary_value(node); end +# internal bytes forced the encoding to US-ASCII +# +# source://prism//lib/prism/node.rb#18632 +Prism::SymbolFlags::FORCED_US_ASCII_ENCODING = T.let(T.unsafe(nil), Integer) - # Negate the value of a numeric node. This is a special case where you - # have a negative sign on one line and then a number on the next line. - # In normal Ruby, this will always be a method call. The parser gem, - # however, marks this as a numeric literal. We have to massage the tree - # here to get it into the correct form. - # - # source://prism//lib/prism/translation/parser/compiler.rb#1824 - def numeric_negate(message_loc, receiver); end +# internal bytes forced the encoding to UTF-8 +# +# source://prism//lib/prism/node.rb#18626 +Prism::SymbolFlags::FORCED_UTF8_ENCODING = T.let(T.unsafe(nil), Integer) - # Blocks can have a special set of parameters that automatically expand - # when given arrays if they have a single required parameter and no - # other parameters. +# Represents a symbol literal or a symbol contained within a `%i` list. +# +# :foo +# ^^^^ +# +# %i[foo] +# ^^^ +# +# source://prism//lib/prism/node.rb#17201 +class Prism::SymbolNode < ::Prism::Node + # Initialize a new SymbolNode node. # - # @return [Boolean] + # @return [SymbolNode] a new instance of SymbolNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1836 - def procarg0?(parameters); end + # source://prism//lib/prism/node.rb#17203 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + value_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).void + end + def initialize(source, node_id, location, flags, opening_loc, value_loc, closing_loc, unescaped); end - # Because we have mutated the AST to allow for newlines in the middle of - # a rational, we need to manually handle the value here. + # Implements case-equality for the node. This is effectively == but without + # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/translation/parser/compiler.rb#1849 - def rational_value(node); end + # source://prism//lib/prism/node.rb#17354 + def ===(other); end - # Constructs a new source range from the given start and end offsets. + # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/translation/parser/compiler.rb#1863 - def srange(location); end + # source://prism//lib/prism/node.rb#17215 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } + def accept(visitor); end - # Constructs a new source range by finding the given tokens between the - # given start offset and end offset. If the needle is not found, it - # returns nil. Importantly it does not search past newlines or comments. + # def child_nodes: () -> Array[nil | Node] # - # Note that end_offset is allowed to be nil, in which case this will - # search until the end of the string. + # source://prism//lib/prism/node.rb#17220 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def child_nodes; end + + # def closing: () -> String? # - # source://prism//lib/prism/translation/parser/compiler.rb#1878 - def srange_find(start_offset, end_offset, tokens); end + # source://prism//lib/prism/node.rb#17333 + sig { returns(T.nilable(String)) } + def closing; end - # Constructs a new source range from the given start and end offsets. + # attr_reader closing_loc: Location? # - # source://prism//lib/prism/translation/parser/compiler.rb#1868 - def srange_offsets(start_offset, end_offset); end + # source://prism//lib/prism/node.rb#17301 + sig { returns(T.nilable(Prism::Location)) } + def closing_loc; end - # Transform a location into a token that the parser gem expects. + # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/translation/parser/compiler.rb#1888 - def token(location); end + # source://prism//lib/prism/node.rb#17230 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } + def comment_targets; end - # Visit a block node on a call. + # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1893 - def visit_block(call, block); end + # source://prism//lib/prism/node.rb#17225 + sig { override.returns(T::Array[Prism::Node]) } + def compact_child_nodes; end - # Visit a heredoc that can be either a string or an xstring. + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode # - # source://prism//lib/prism/translation/parser/compiler.rb#1927 - def visit_heredoc(node); end + # source://prism//lib/prism/node.rb#17235 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + value_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location), + unescaped: String + ).returns(Prism::SymbolNode) + end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), value_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end - # Visit a numeric node and account for the optional sign. + # def child_nodes: () -> Array[nil | Node] + # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/translation/parser/compiler.rb#1973 - def visit_numeric(node, value); end + # source://prism//lib/prism/node.rb#17220 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } + def deconstruct; end - # Within the given block, track that we're within a pattern. + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, value_loc: Location?, closing_loc: Location?, unescaped: String } # - # source://prism//lib/prism/translation/parser/compiler.rb#1985 - def within_pattern; end -end + # source://prism//lib/prism/node.rb#17243 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end -# Raised when the tree is malformed or there is a bug in the compiler. -# -# source://prism//lib/prism/translation/parser/compiler.rb#10 -class Prism::Translation::Parser::Compiler::CompilationError < ::StandardError; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } + def fields; end -# Locations in the parser gem AST are generated using this class. We -# store a reference to its constant to make it slightly faster to look -# up. -# -# source://prism//lib/prism/translation/parser/compiler.rb#1860 -Prism::Translation::Parser::Compiler::Range = Parser::Source::Range + # def forced_binary_encoding?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#17253 + sig { returns(T::Boolean) } + def forced_binary_encoding?; end -# source://prism//lib/prism/translation/parser.rb#12 -Prism::Translation::Parser::Diagnostic = Parser::Diagnostic + # def forced_us_ascii_encoding?: () -> bool + # + # @return [Boolean] + # + # source://prism//lib/prism/node.rb#17258 + sig { returns(T::Boolean) } + def forced_us_ascii_encoding?; end -# Accepts a list of prism tokens and converts them into the expected -# format for the parser gem. -# -# source://prism//lib/prism/translation/parser/lexer.rb#8 -class Prism::Translation::Parser::Lexer - # Initialize the lexer with the given source buffer, prism tokens, and - # offset cache. + # def forced_utf8_encoding?: () -> bool # - # @return [Lexer] a new instance of Lexer + # @return [Boolean] # - # source://prism//lib/prism/translation/parser/lexer.rb#204 - def initialize(source_buffer, lexed, offset_cache); end + # source://prism//lib/prism/node.rb#17248 + sig { returns(T::Boolean) } + def forced_utf8_encoding?; end - # An array of tuples that contain prism tokens and their associated lex - # state when they were lexed. + # def inspect -> String # - # source://prism//lib/prism/translation/parser/lexer.rb#197 - def lexed; end + # source://prism//lib/prism/node.rb#17338 + sig { override.returns(String) } + def inspect; end - # A hash that maps offsets in bytes to offsets in characters. + # def opening: () -> String? # - # source://prism//lib/prism/translation/parser/lexer.rb#200 - def offset_cache; end + # source://prism//lib/prism/node.rb#17323 + sig { returns(T.nilable(String)) } + def opening; end - # The Parser::Source::Buffer that the tokens were lexed from. + # attr_reader opening_loc: Location? # - # source://prism//lib/prism/translation/parser/lexer.rb#193 - def source_buffer; end + # source://prism//lib/prism/node.rb#17263 + sig { returns(T.nilable(Prism::Location)) } + def opening_loc; end - # Convert the prism tokens into the expected format for the parser gem. + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/lexer.rb#214 - def to_a; end + # source://prism//lib/prism/node.rb#17315 + def save_closing_loc(repository); end - private + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17277 + def save_opening_loc(repository); end - # Parse a complex from the string representation. + # Save the value_loc location using the given saved source so that + # it can be retrieved later. # - # source://prism//lib/prism/translation/parser/lexer.rb#387 - def parse_complex(value); end + # source://prism//lib/prism/node.rb#17296 + def save_value_loc(repository); end - # Parse a float from the string representation. + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/translation/parser/lexer.rb#380 - def parse_float(value); end + # source://prism//lib/prism/node.rb#17343 + sig { override.returns(Symbol) } + def type; end - # Parse an integer from the string representation. + # attr_reader unescaped: String # - # source://prism//lib/prism/translation/parser/lexer.rb#373 - def parse_integer(value); end + # source://prism//lib/prism/node.rb#17320 + sig { returns(String) } + def unescaped; end - # Parse a rational from the string representation. + # def value: () -> String? # - # source://prism//lib/prism/translation/parser/lexer.rb#402 - def parse_rational(value); end -end + # source://prism//lib/prism/node.rb#17328 + sig { returns(T.nilable(String)) } + def value; end -# These constants represent flags in our lex state. We really, really -# don't want to be using them and we really, really don't want to be -# exposing them as part of our public API. Unfortunately, we don't have -# another way of matching the exact tokens that the parser gem expects -# without them. We should find another way to do this, but in the -# meantime we'll hide them from the documentation and mark them as -# private constants. -# -# source://prism//lib/prism/translation/parser/lexer.rb#187 -Prism::Translation::Parser::Lexer::EXPR_BEG = T.let(T.unsafe(nil), Integer) - -# source://prism//lib/prism/translation/parser/lexer.rb#188 -Prism::Translation::Parser::Lexer::EXPR_LABEL = T.let(T.unsafe(nil), Integer) - -# source://prism//lib/prism/translation/parser/lexer.rb#210 -Prism::Translation::Parser::Lexer::Range = Parser::Source::Range + # attr_reader value_loc: Location? + # + # source://prism//lib/prism/node.rb#17282 + sig { returns(T.nilable(Prism::Location)) } + def value_loc; end -# The direct translating of types between the two lexers. -# -# source://prism//lib/prism/translation/parser/lexer.rb#10 -Prism::Translation::Parser::Lexer::TYPES = T.let(T.unsafe(nil), Hash) + class << self + # Return a symbol representation of this node type. See `Node::type`. + # + # source://prism//lib/prism/node.rb#17348 + def type; end + end +end -# The parser gem has a list of diagnostics with a hard-coded set of error -# messages. We create our own diagnostic class in order to set our own -# error messages. +# This represents a token from the Ruby source. # -# source://prism//lib/prism/translation/parser.rb#18 -class Prism::Translation::Parser::PrismDiagnostic < ::Parser::Diagnostic - # Initialize a new diagnostic with the given message and location. +# source://prism//lib/prism/parse_result.rb#816 +class Prism::Token + # Create a new token object with the given type, value, and location. # - # @return [PrismDiagnostic] a new instance of PrismDiagnostic + # @return [Token] a new instance of Token # - # source://prism//lib/prism/translation/parser.rb#23 - def initialize(message, level, reason, location); end + # source://prism//lib/prism/parse_result.rb#828 + sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void } + def initialize(source, type, value, location); end - # This is the cached message coming from prism. + # Returns true if the given other token is equal to this token. # - # source://prism//lib/prism/translation/parser.rb#20 - def message; end -end - -# source://prism//lib/prism/translation/parser.rb#29 -Prism::Translation::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass) + # source://prism//lib/prism/parse_result.rb#863 + sig { params(other: T.untyped).returns(T::Boolean) } + def ==(other); end -# This class provides a compatibility layer between prism and Ripper. It -# functions by parsing the entire tree first and then walking it and -# executing each of the Ripper callbacks as it goes. To use this class, you -# treat `Prism::Translation::Ripper` effectively as you would treat the -# `Ripper` class. -# -# Note that this class will serve the most common use cases, but Ripper's -# API is extensive and undocumented. It relies on reporting the state of the -# parser at any given time. We do our best to replicate that here, but -# because it is a different architecture it is not possible to perfectly -# replicate the behavior of Ripper. -# -# The main known difference is that we may omit dispatching some events in -# some cases. This impacts the following events: -# -# - on_assign_error -# - on_comma -# - on_ignored_nl -# - on_ignored_sp -# - on_kw -# - on_label_end -# - on_lbrace -# - on_lbracket -# - on_lparen -# - on_nl -# - on_op -# - on_operator_ambiguous -# - on_rbrace -# - on_rbracket -# - on_rparen -# - on_semicolon -# - on_sp -# - on_symbeg -# - on_tstring_beg -# - on_tstring_end -# -# source://prism//lib/prism/translation/ripper.rb#43 -class Prism::Translation::Ripper < ::Prism::Compiler - # Create a new Translation::Ripper object with the given source. - # - # @return [Ripper] a new instance of Ripper + # Implement the hash pattern matching interface for Token. # - # source://prism//lib/prism/translation/ripper.rb#444 - def initialize(source, filename = T.unsafe(nil), lineno = T.unsafe(nil)); end + # source://prism//lib/prism/parse_result.rb#836 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } + def deconstruct_keys(keys); end - # The current column number of the parser. + # Freeze this object and the objects it contains. # - # source://prism//lib/prism/translation/ripper.rb#441 - def column; end + # source://prism//lib/prism/parse_result.rb#876 + def deep_freeze; end - # True if the parser encountered an error during parsing. + # Returns a string representation of this token. # - # @return [Boolean] + # source://prism//lib/prism/parse_result.rb#870 + def inspect; end + + # A Location object representing the location of this token in the source. # - # source://prism//lib/prism/translation/ripper.rb#457 - sig { returns(T::Boolean) } - def error?; end + # source://prism//lib/prism/parse_result.rb#841 + sig { returns(Prism::Location) } + def location; end - # The filename of the source being parsed. + # Implement the pretty print interface for Token. # - # source://prism//lib/prism/translation/ripper.rb#435 - def filename; end + # source://prism//lib/prism/parse_result.rb#848 + sig { params(q: T.untyped).void } + def pretty_print(q); end - # The current line number of the parser. + # The type of token that this token is. # - # source://prism//lib/prism/translation/ripper.rb#438 - def lineno; end + # source://prism//lib/prism/parse_result.rb#822 + sig { returns(Symbol) } + def type; end - # Parse the source and return the result. + # A byteslice of the source that this token represents. # - # source://prism//lib/prism/translation/ripper.rb#462 - sig { returns(T.nilable(Result)) } - def parse; end + # source://prism//lib/prism/parse_result.rb#825 + sig { returns(String) } + def value; end - # The source that is being parsed. + private + + # The Source object that represents the source this token came from. # - # source://prism//lib/prism/translation/ripper.rb#432 + # source://prism//lib/prism/parse_result.rb#818 + sig { returns(Prism::Source) } def source; end +end - # alias $foo $bar - # ^^^^^^^^^^^^^^^ +# This module is responsible for converting the prism syntax tree into other +# syntax trees. +# +# source://prism//lib/prism/translation.rb#6 +module Prism::Translation; end + +# This class is the entry-point for converting a prism syntax tree into the +# whitequark/parser gem's syntax tree. It inherits from the base parser for +# the parser gem, and overrides the parse* methods to parse with prism and +# then translate. +# +# source://prism//lib/prism/translation/parser.rb#16 +class Prism::Translation::Parser < ::Parser::Base + # The `builder` argument is used to create the parser using our custom builder class by default. # - # source://prism//lib/prism/translation/ripper.rb#561 - def visit_alias_global_variable_node(node); end + # By using the `:parser` keyword argument, you can translate in a way that is compatible with + # the Parser gem using any parser. + # + # For example, in RuboCop for Ruby LSP, the following approach can be used to improve performance + # by reusing a pre-parsed `Prism::ParseLexResult`: + # + # class PrismPreparsed + # def initialize(prism_result) + # @prism_result = prism_result + # end + # + # def parse_lex(source, **options) + # @prism_result + # end + # end + # + # prism_preparsed = PrismPreparsed.new(prism_result) + # + # Prism::Translation::Ruby34.new(builder, parser: prism_preparsed) + # + # In an object passed to the `:parser` keyword argument, the `parse` and `parse_lex` methods + # should be implemented as needed. + # + # @return [Parser] a new instance of Parser + # + # source://prism//lib/prism/translation/parser.rb#61 + def initialize(builder = T.unsafe(nil), parser: T.unsafe(nil)); end - # alias foo bar - # ^^^^^^^^^^^^^ + # The default encoding for Ruby files is UTF-8. # - # source://prism//lib/prism/translation/ripper.rb#551 - def visit_alias_method_node(node); end + # source://prism//lib/prism/translation/parser.rb#72 + def default_encoding; end - # foo => bar | baz - # ^^^^^^^^^ + # Parses a source buffer and returns the AST. # - # source://prism//lib/prism/translation/ripper.rb#585 - def visit_alternation_pattern_node(node); end + # source://prism//lib/prism/translation/parser.rb#80 + def parse(source_buffer); end - # a and b - # ^^^^^^^ + # Parses a source buffer and returns the AST and the source code comments. # - # source://prism//lib/prism/translation/ripper.rb#605 - def visit_and_node(node); end + # source://prism//lib/prism/translation/parser.rb#93 + def parse_with_comments(source_buffer); end - # foo(bar) - # ^^^ + # Parses a source buffer and returns the AST, the source code comments, + # and the tokens emitted by the lexer. # - # source://prism//lib/prism/translation/ripper.rb#796 - def visit_arguments_node(node); end + # source://prism//lib/prism/translation/parser.rb#110 + def tokenize(source_buffer, recover = T.unsafe(nil)); end - # [] - # ^^ + # Since prism resolves num params for us, we don't need to support this + # kind of logic here. # - # source://prism//lib/prism/translation/ripper.rb#615 - def visit_array_node(node); end + # source://prism//lib/prism/translation/parser.rb#136 + def try_declare_numparam(node); end - # foo => [bar] - # ^^^^^ + # source://prism//lib/prism/translation/parser.rb#67 + sig { overridable.returns(Integer) } + def version; end + + # source://prism//lib/prism/translation/parser.rb#76 + def yyerror; end + + private + + # Build the parser gem AST from the prism AST. # - # source://prism//lib/prism/translation/ripper.rb#775 - def visit_array_pattern_node(node); end + # source://prism//lib/prism/translation/parser.rb#294 + def build_ast(program, offset_cache); end - # { a: 1 } - # ^^^^ + # Build the parser gem comments from the prism comments. # - # source://prism//lib/prism/translation/ripper.rb#803 - def visit_assoc_node(node); end + # source://prism//lib/prism/translation/parser.rb#299 + def build_comments(comments, offset_cache); end - # def foo(**); bar(**); end - # ^^ + # Prism deals with offsets in bytes, while the parser gem deals with + # offsets in characters. We need to handle this conversion in order to + # build the parser gem AST. # - # { **foo } - # ^^^^^ + # If the bytesize of the source is the same as the length, then we can + # just use the offset directly. Otherwise, we build an array where the + # index is the byte offset and the value is the character offset. # - # source://prism//lib/prism/translation/ripper.rb#816 - def visit_assoc_splat_node(node); end + # source://prism//lib/prism/translation/parser.rb#277 + def build_offset_cache(source); end - # $+ - # ^^ + # Build a range from a prism location. # - # source://prism//lib/prism/translation/ripper.rb#825 - def visit_back_reference_read_node(node); end + # source://prism//lib/prism/translation/parser.rb#311 + def build_range(location, offset_cache); end - # begin end - # ^^^^^^^^^ + # Build the parser gem tokens from the prism tokens. # - # source://prism//lib/prism/translation/ripper.rb#832 - def visit_begin_node(node); end + # source://prism//lib/prism/translation/parser.rb#306 + def build_tokens(tokens, offset_cache); end - # foo(&bar) - # ^^^^ + # Converts the version format handled by Parser to the format handled by Prism. # - # source://prism//lib/prism/translation/ripper.rb#896 - def visit_block_argument_node(node); end + # source://prism//lib/prism/translation/parser.rb#334 + def convert_for_prism(version); end - # foo { |; bar| } - # ^^^ + # Build a diagnostic from the given prism parse error. # - # source://prism//lib/prism/translation/ripper.rb#902 - def visit_block_local_variable_node(node); end + # source://prism//lib/prism/translation/parser.rb#155 + def error_diagnostic(error, offset_cache); end - # Visit a BlockNode. + # Options for how prism should parse/lex the source. # - # source://prism//lib/prism/translation/ripper.rb#908 - def visit_block_node(node); end + # source://prism//lib/prism/translation/parser.rb#320 + def prism_options; end - # def foo(&bar); end - # ^^^^ + # If there was a error generated during the parse, then raise an + # appropriate syntax error. Otherwise return the result. # - # source://prism//lib/prism/translation/ripper.rb#944 - def visit_block_parameter_node(node); end + # source://prism//lib/prism/translation/parser.rb#255 + def unwrap(result, offset_cache); end - # A block's parameters. + # This is a hook to allow consumers to disable some errors if they don't + # want them to block creating the syntax tree. # - # source://prism//lib/prism/translation/ripper.rb#958 - def visit_block_parameters_node(node); end - - # break + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser.rb#144 + def valid_error?(error); end + + # This is a hook to allow consumers to disable some warnings if they don't + # want them to block creating the syntax tree. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser.rb#150 + def valid_warning?(warning); end + + # Build a diagnostic from the given prism parse warning. + # + # source://prism//lib/prism/translation/parser.rb#228 + def warning_diagnostic(warning, offset_cache); end +end + +# This class is the entry-point for Ruby 3.3 of `Prism::Translation::Parser`. +# +# source://prism//lib/prism/translation/parser33.rb#6 +class Prism::Translation::Parser33 < ::Prism::Translation::Parser + # source://prism//lib/prism/translation/parser33.rb#7 + sig { override.returns(Integer) } + def version; end +end + +# This class is the entry-point for Ruby 3.4 of `Prism::Translation::Parser`. +# +# source://prism//lib/prism/translation/parser34.rb#6 +class Prism::Translation::Parser34 < ::Prism::Translation::Parser + # source://prism//lib/prism/translation/parser34.rb#7 + sig { override.returns(Integer) } + def version; end +end + +# This class is the entry-point for Ruby 3.5 of `Prism::Translation::Parser`. +# +# source://prism//lib/prism/translation/parser35.rb#6 +class Prism::Translation::Parser35 < ::Prism::Translation::Parser + # source://prism//lib/prism/translation/parser35.rb#7 + sig { override.returns(Integer) } + def version; end +end + +# A builder that knows how to convert more modern Ruby syntax +# into whitequark/parser gem's syntax tree. +# +# source://prism//lib/prism/translation/parser/builder.rb#8 +class Prism::Translation::Parser::Builder < ::Parser::Builders::Default + # The following three lines have been added to support the `it` block parameter syntax in the source code below. + # + # if args.type == :itarg + # block_type = :itblock + # args = :it + # + # https://github.com/whitequark/parser/blob/v3.3.7.1/lib/parser/builders/default.rb#L1122-L1155 + # + # source://prism//lib/prism/translation/parser/builder.rb#21 + def block(method_call, begin_t, args, body, end_t); end + + # It represents the `it` block argument, which is not yet implemented in the Parser gem. + # + # source://prism//lib/prism/translation/parser/builder.rb#10 + def itarg; end +end + +# A visitor that knows how to convert a prism syntax tree into the +# whitequark/parser gem's syntax tree. +# +# source://prism//lib/prism/translation/parser/compiler.rb#8 +class Prism::Translation::Parser::Compiler < ::Prism::Compiler + # Initialize a new compiler with the given parser, offset cache, and + # options. + # + # @return [Compiler] a new instance of Compiler + # + # source://prism//lib/prism/translation/parser/compiler.rb#39 + def initialize(parser, offset_cache, forwarding: T.unsafe(nil), in_destructure: T.unsafe(nil), in_pattern: T.unsafe(nil)); end + + # The Parser::Builders::Default instance that is being used to build the + # AST. + # + # source://prism//lib/prism/translation/parser/compiler.rb#18 + def builder; end + + # The types of values that can be forwarded in the current scope. + # + # source://prism//lib/prism/translation/parser/compiler.rb#29 + def forwarding; end + + # Whether or not the current node is in a destructure. + # + # source://prism//lib/prism/translation/parser/compiler.rb#32 + def in_destructure; end + + # Whether or not the current node is in a pattern. + # + # source://prism//lib/prism/translation/parser/compiler.rb#35 + def in_pattern; end + + # The offset cache that is used to map between byte and character + # offsets in the file. + # + # source://prism//lib/prism/translation/parser/compiler.rb#26 + def offset_cache; end + + # The Parser::Base instance that is being used to build the AST. + # + # source://prism//lib/prism/translation/parser/compiler.rb#14 + def parser; end + + # The Parser::Source::Buffer instance that is holding a reference to the + # source code. + # + # source://prism//lib/prism/translation/parser/compiler.rb#22 + def source_buffer; end + + # alias $foo $bar + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#58 + def visit_alias_global_variable_node(node); end + + # alias foo bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#52 + def visit_alias_method_node(node); end + + # foo => bar | baz + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#64 + def visit_alternation_pattern_node(node); end + + # a and b + # ^^^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#70 + def visit_and_node(node); end + + # foo(bar) + # ^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#127 + def visit_arguments_node(node); end + + # [] + # ^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#76 + def visit_array_node(node); end + + # foo => [bar] + # ^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#104 + def visit_array_pattern_node(node); end + + # { a: 1 } + # ^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#133 + def visit_assoc_node(node); end + + # def foo(**); bar(**); end + # ^^ + # + # { **foo } + # ^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#185 + def visit_assoc_splat_node(node); end + + # $+ + # ^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#197 + def visit_back_reference_read_node(node); end + + # begin end + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#203 + def visit_begin_node(node); end + + # foo(&bar) + # ^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#248 + def visit_block_argument_node(node); end + + # foo { |; bar| } + # ^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#254 + def visit_block_local_variable_node(node); end + + # A block on a keyword or method call. + # + # @raise [CompilationError] + # + # source://prism//lib/prism/translation/parser/compiler.rb#259 + def visit_block_node(node); end + + # def foo(&bar); end + # ^^^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#265 + def visit_block_parameter_node(node); end + + # A block's parameters. + # + # source://prism//lib/prism/translation/parser/compiler.rb#270 + def visit_block_parameters_node(node); end + + # break # ^^^^^ # # break foo # ^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#982 + # source://prism//lib/prism/translation/parser/compiler.rb#279 def visit_break_node(node); end # foo.bar &&= baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1194 + # source://prism//lib/prism/translation/parser/compiler.rb#384 def visit_call_and_write_node(node); end # foo @@ -32288,136 +34529,133 @@ class Prism::Translation::Ripper < ::Prism::Compiler # foo.bar() {} # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1002 + # source://prism//lib/prism/translation/parser/compiler.rb#291 def visit_call_node(node); end # foo.bar += baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1172 + # source://prism//lib/prism/translation/parser/compiler.rb#365 def visit_call_operator_write_node(node); end # foo.bar ||= baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1216 + # source://prism//lib/prism/translation/parser/compiler.rb#403 def visit_call_or_write_node(node); end # foo.bar, = 1 # ^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1238 + # source://prism//lib/prism/translation/parser/compiler.rb#422 def visit_call_target_node(node); end # foo => bar => baz # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1263 + # source://prism//lib/prism/translation/parser/compiler.rb#434 def visit_capture_pattern_node(node); end # case foo; in bar; end # ^^^^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1286 + # source://prism//lib/prism/translation/parser/compiler.rb#453 def visit_case_match_node(node); end # case foo; when bar; end # ^^^^^^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1273 + # source://prism//lib/prism/translation/parser/compiler.rb#440 def visit_case_node(node); end # class Foo; end # ^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1299 + # source://prism//lib/prism/translation/parser/compiler.rb#466 def visit_class_node(node); end # @@foo &&= bar # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1352 + # source://prism//lib/prism/translation/parser/compiler.rb#505 def visit_class_variable_and_write_node(node); end # @@foo += bar # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1338 + # source://prism//lib/prism/translation/parser/compiler.rb#495 def visit_class_variable_operator_write_node(node); end # @@foo ||= bar # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1366 + # source://prism//lib/prism/translation/parser/compiler.rb#515 def visit_class_variable_or_write_node(node); end # @@foo # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1317 + # source://prism//lib/prism/translation/parser/compiler.rb#479 def visit_class_variable_read_node(node); end # @@foo, = bar # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1380 + # source://prism//lib/prism/translation/parser/compiler.rb#525 def visit_class_variable_target_node(node); end # @@foo = 1 # ^^^^^^^^^ # - # @@foo, @@bar = 1 - # ^^^^^ ^^^^^ - # - # source://prism//lib/prism/translation/ripper.rb#1327 + # source://prism//lib/prism/translation/parser/compiler.rb#485 def visit_class_variable_write_node(node); end # Foo &&= bar # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1422 + # source://prism//lib/prism/translation/parser/compiler.rb#556 def visit_constant_and_write_node(node); end # Foo += bar # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1408 + # source://prism//lib/prism/translation/parser/compiler.rb#546 def visit_constant_operator_write_node(node); end # Foo ||= bar # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1436 + # source://prism//lib/prism/translation/parser/compiler.rb#566 def visit_constant_or_write_node(node); end # Foo::Bar &&= baz # ^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1523 + # source://prism//lib/prism/translation/parser/compiler.rb#622 def visit_constant_path_and_write_node(node); end # Foo::Bar # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1457 + # source://prism//lib/prism/translation/parser/compiler.rb#582 def visit_constant_path_node(node); end # Foo::Bar += baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1509 + # source://prism//lib/prism/translation/parser/compiler.rb#612 def visit_constant_path_operator_write_node(node); end # Foo::Bar ||= baz # ^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1537 + # source://prism//lib/prism/translation/parser/compiler.rb#632 def visit_constant_path_or_write_node(node); end # Foo::Bar, = baz # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1551 + # source://prism//lib/prism/translation/parser/compiler.rb#642 def visit_constant_path_target_node(node); end # Foo::Bar = 1 @@ -32426,19 +34664,19 @@ class Prism::Translation::Ripper < ::Prism::Compiler # Foo::Foo, Bar::Bar = 1 # ^^^^^^^^ ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1480 + # source://prism//lib/prism/translation/parser/compiler.rb#602 def visit_constant_path_write_node(node); end # Foo # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1387 + # source://prism//lib/prism/translation/parser/compiler.rb#531 def visit_constant_read_node(node); end # Foo, = bar # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1450 + # source://prism//lib/prism/translation/parser/compiler.rb#576 def visit_constant_target_node(node); end # Foo = 1 @@ -32447,7 +34685,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # Foo, Bar = 1 # ^^^ ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1397 + # source://prism//lib/prism/translation/parser/compiler.rb#540 def visit_constant_write_node(node); end # def foo; end @@ -32456,7 +34694,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # def self.foo; end # ^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1560 + # source://prism//lib/prism/translation/parser/compiler.rb#651 def visit_def_node(node); end # defined? a @@ -32465,72 +34703,77 @@ class Prism::Translation::Ripper < ::Prism::Compiler # defined?(a) # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1607 + # source://prism//lib/prism/translation/parser/compiler.rb#698 def visit_defined_node(node); end # if foo then bar else baz end # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1614 + # source://prism//lib/prism/translation/parser/compiler.rb#710 def visit_else_node(node); end # "foo #{bar}" # ^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1630 + # source://prism//lib/prism/translation/parser/compiler.rb#716 def visit_embedded_statements_node(node); end # "foo #@bar" # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1651 + # source://prism//lib/prism/translation/parser/compiler.rb#726 def visit_embedded_variable_node(node); end - # Visit an EnsureNode node. + # begin; foo; ensure; bar; end + # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1662 + # @raise [CompilationError] + # + # source://prism//lib/prism/translation/parser/compiler.rb#732 def visit_ensure_node(node); end # false # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1680 + # source://prism//lib/prism/translation/parser/compiler.rb#738 def visit_false_node(node); end # foo => [*, bar, *] # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1687 + # source://prism//lib/prism/translation/parser/compiler.rb#744 def visit_find_pattern_node(node); end + # 0..5 + # ^^^^ # if foo .. bar; end # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1712 + # source://prism//lib/prism/translation/parser/compiler.rb#1501 def visit_flip_flop_node(node); end # 1.0 # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1726 + # source://prism//lib/prism/translation/parser/compiler.rb#756 def visit_float_node(node); end # for foo in bar do end # ^^^^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1732 + # source://prism//lib/prism/translation/parser/compiler.rb#762 def visit_for_node(node); end # def foo(...); bar(...); end # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1749 + # source://prism//lib/prism/translation/parser/compiler.rb#780 def visit_forwarding_arguments_node(node); end # def foo(...); end # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#1756 + # source://prism//lib/prism/translation/parser/compiler.rb#786 def visit_forwarding_parameter_node(node); end # super @@ -32539,58 +34782,55 @@ class Prism::Translation::Ripper < ::Prism::Compiler # super {} # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1766 + # source://prism//lib/prism/translation/parser/compiler.rb#795 def visit_forwarding_super_node(node); end # $foo &&= bar # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1815 + # source://prism//lib/prism/translation/parser/compiler.rb#833 def visit_global_variable_and_write_node(node); end # $foo += bar # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1801 + # source://prism//lib/prism/translation/parser/compiler.rb#823 def visit_global_variable_operator_write_node(node); end # $foo ||= bar # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1829 + # source://prism//lib/prism/translation/parser/compiler.rb#843 def visit_global_variable_or_write_node(node); end # $foo # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1780 + # source://prism//lib/prism/translation/parser/compiler.rb#807 def visit_global_variable_read_node(node); end # $foo, = bar # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1843 + # source://prism//lib/prism/translation/parser/compiler.rb#853 def visit_global_variable_target_node(node); end # $foo = 1 # ^^^^^^^^ # - # $foo, $bar = 1 - # ^^^^ ^^^^ - # - # source://prism//lib/prism/translation/ripper.rb#1790 + # source://prism//lib/prism/translation/parser/compiler.rb#813 def visit_global_variable_write_node(node); end # {} # ^^ # - # source://prism//lib/prism/translation/ripper.rb#1850 + # source://prism//lib/prism/translation/parser/compiler.rb#859 def visit_hash_node(node); end # foo => {} # ^^ # - # source://prism//lib/prism/translation/ripper.rb#1865 + # source://prism//lib/prism/translation/parser/compiler.rb#869 def visit_hash_pattern_node(node); end # if foo then bar end @@ -32602,134 +34842,146 @@ class Prism::Translation::Ripper < ::Prism::Compiler # foo ? bar : baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1907 + # source://prism//lib/prism/translation/parser/compiler.rb#887 def visit_if_node(node); end # 1i # ^^ # - # source://prism//lib/prism/translation/ripper.rb#1943 + # source://prism//lib/prism/translation/parser/compiler.rb#929 def visit_imaginary_node(node); end # { foo: } # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1949 + # @raise [CompilationError] + # + # source://prism//lib/prism/translation/parser/compiler.rb#935 def visit_implicit_node(node); end # foo { |bar,| } # ^ # - # source://prism//lib/prism/translation/ripper.rb#1954 + # @raise [CompilationError] + # + # source://prism//lib/prism/translation/parser/compiler.rb#941 def visit_implicit_rest_node(node); end # case foo; in bar; end # ^^^^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1961 + # source://prism//lib/prism/translation/parser/compiler.rb#947 def visit_in_node(node); end # foo[bar] &&= baz # ^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1996 + # source://prism//lib/prism/translation/parser/compiler.rb#995 def visit_index_and_write_node(node); end # foo[bar] += baz # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#1979 + # source://prism//lib/prism/translation/parser/compiler.rb#977 def visit_index_operator_write_node(node); end # foo[bar] ||= baz # ^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2013 + # source://prism//lib/prism/translation/parser/compiler.rb#1013 def visit_index_or_write_node(node); end # foo[bar], = 1 # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2030 + # source://prism//lib/prism/translation/parser/compiler.rb#1031 def visit_index_target_node(node); end # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2072 + # source://prism//lib/prism/translation/parser/compiler.rb#1068 def visit_instance_variable_and_write_node(node); end # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2058 + # source://prism//lib/prism/translation/parser/compiler.rb#1058 def visit_instance_variable_operator_write_node(node); end # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2086 + # source://prism//lib/prism/translation/parser/compiler.rb#1078 def visit_instance_variable_or_write_node(node); end # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2040 + # source://prism//lib/prism/translation/parser/compiler.rb#1042 def visit_instance_variable_read_node(node); end # @foo, = bar # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2100 + # source://prism//lib/prism/translation/parser/compiler.rb#1088 def visit_instance_variable_target_node(node); end # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2047 + # source://prism//lib/prism/translation/parser/compiler.rb#1048 def visit_instance_variable_write_node(node); end # 1 # ^ # - # source://prism//lib/prism/translation/ripper.rb#2107 + # source://prism//lib/prism/translation/parser/compiler.rb#1094 def visit_integer_node(node); end + # /foo #{bar}/ + # ^^^^^^^^^^^^ # if /foo #{bar}/ then end # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2113 + # source://prism//lib/prism/translation/parser/compiler.rb#1100 def visit_interpolated_match_last_line_node(node); end # /foo #{bar}/ # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2132 + # source://prism//lib/prism/translation/parser/compiler.rb#1100 def visit_interpolated_regular_expression_node(node); end # "foo #{bar}" # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2151 + # source://prism//lib/prism/translation/parser/compiler.rb#1115 def visit_interpolated_string_node(node); end # :"foo #{bar}" # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2179 + # source://prism//lib/prism/translation/parser/compiler.rb#1129 def visit_interpolated_symbol_node(node); end # `foo #{bar}` # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2192 + # source://prism//lib/prism/translation/parser/compiler.rb#1139 def visit_interpolated_x_string_node(node); end + # -> { it } + # ^^ + # + # source://prism//lib/prism/translation/parser/compiler.rb#1153 + def visit_it_local_variable_read_node(node); end + # -> { it } # ^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2222 + # source://prism//lib/prism/translation/parser/compiler.rb#1159 def visit_it_parameters_node(node); end # foo(bar: baz) # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2227 + # source://prism//lib/prism/translation/parser/compiler.rb#1175 def visit_keyword_hash_node(node); end # def foo(**bar); end @@ -32738,96 +34990,100 @@ class Prism::Translation::Ripper < ::Prism::Compiler # def foo(**); end # ^^ # - # source://prism//lib/prism/translation/ripper.rb#2239 + # source://prism//lib/prism/translation/parser/compiler.rb#1184 def visit_keyword_rest_parameter_node(node); end # -> {} + # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2253 + # source://prism//lib/prism/translation/parser/compiler.rb#1193 def visit_lambda_node(node); end # foo &&= bar # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2350 + # source://prism//lib/prism/translation/parser/compiler.rb#1245 def visit_local_variable_and_write_node(node); end # foo += bar # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2336 + # source://prism//lib/prism/translation/parser/compiler.rb#1235 def visit_local_variable_operator_write_node(node); end # foo ||= bar # ^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2364 + # source://prism//lib/prism/translation/parser/compiler.rb#1255 def visit_local_variable_or_write_node(node); end # foo # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#2313 + # source://prism//lib/prism/translation/parser/compiler.rb#1219 def visit_local_variable_read_node(node); end # foo, = bar # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#2378 + # source://prism//lib/prism/translation/parser/compiler.rb#1265 def visit_local_variable_target_node(node); end # foo = 1 # ^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2325 + # source://prism//lib/prism/translation/parser/compiler.rb#1225 def visit_local_variable_write_node(node); end + # /foo/ + # ^^^^^ # if /foo/ then end # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2385 + # source://prism//lib/prism/translation/parser/compiler.rb#1535 def visit_match_last_line_node(node); end # foo in bar # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2400 + # source://prism//lib/prism/translation/parser/compiler.rb#1275 def visit_match_predicate_node(node); end # foo => bar # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2409 + # source://prism//lib/prism/translation/parser/compiler.rb#1285 def visit_match_required_node(node); end # /(?foo)/ =~ bar # ^^^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2418 + # source://prism//lib/prism/translation/parser/compiler.rb#1295 def visit_match_write_node(node); end # A node that is missing from the syntax tree. This is only used in the - # case of a syntax error. + # case of a syntax error. The parser gem doesn't have such a concept, so + # we invent our own here. # - # source://prism//lib/prism/translation/ripper.rb#2424 + # source://prism//lib/prism/translation/parser/compiler.rb#1306 def visit_missing_node(node); end # module Foo; end # ^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2430 + # source://prism//lib/prism/translation/parser/compiler.rb#1312 def visit_module_node(node); end - # (foo, bar), bar = qux - # ^^^^^^^^^^ + # foo, bar = baz + # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2447 + # source://prism//lib/prism/translation/parser/compiler.rb#1323 def visit_multi_target_node(node); end # foo, bar = baz # ^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2501 + # source://prism//lib/prism/translation/parser/compiler.rb#1333 def visit_multi_write_node(node); end # next @@ -32836,55 +35092,55 @@ class Prism::Translation::Ripper < ::Prism::Compiler # next foo # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2521 + # source://prism//lib/prism/translation/parser/compiler.rb#1356 def visit_next_node(node); end # nil # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#2535 + # source://prism//lib/prism/translation/parser/compiler.rb#1368 def visit_nil_node(node); end # def foo(**nil); end # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2542 + # source://prism//lib/prism/translation/parser/compiler.rb#1374 def visit_no_keywords_parameter_node(node); end # -> { _1 + _2 } # ^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2551 + # source://prism//lib/prism/translation/parser/compiler.rb#1384 def visit_numbered_parameters_node(node); end # $1 # ^^ # - # source://prism//lib/prism/translation/ripper.rb#2556 + # source://prism//lib/prism/translation/parser/compiler.rb#1390 def visit_numbered_reference_read_node(node); end # def foo(bar: baz); end # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2563 + # source://prism//lib/prism/translation/parser/compiler.rb#1396 def visit_optional_keyword_parameter_node(node); end # def foo(bar = 1); end # ^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2573 + # source://prism//lib/prism/translation/parser/compiler.rb#1402 def visit_optional_parameter_node(node); end # a or b # ^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2583 + # source://prism//lib/prism/translation/parser/compiler.rb#1408 def visit_or_node(node); end # def foo(bar, *baz); end # ^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2593 + # source://prism//lib/prism/translation/parser/compiler.rb#1414 def visit_parameters_node(node); end # () @@ -32893,84 +35149,84 @@ class Prism::Translation::Ripper < ::Prism::Compiler # (1) # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#2620 + # source://prism//lib/prism/translation/parser/compiler.rb#1453 def visit_parentheses_node(node); end # foo => ^(bar) # ^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2634 + # source://prism//lib/prism/translation/parser/compiler.rb#1463 def visit_pinned_expression_node(node); end # foo = 1 and bar => ^foo # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2643 + # source://prism//lib/prism/translation/parser/compiler.rb#1470 def visit_pinned_variable_node(node); end # END {} - # ^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2649 + # source://prism//lib/prism/translation/parser/compiler.rb#1475 def visit_post_execution_node(node); end # BEGIN {} - # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2664 + # source://prism//lib/prism/translation/parser/compiler.rb#1485 def visit_pre_execution_node(node); end # The top-level program node. # - # source://prism//lib/prism/translation/ripper.rb#2678 + # source://prism//lib/prism/translation/parser/compiler.rb#1495 def visit_program_node(node); end # 0..5 # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2689 + # source://prism//lib/prism/translation/parser/compiler.rb#1501 def visit_range_node(node); end # 1r # ^^ # - # source://prism//lib/prism/translation/ripper.rb#2703 + # source://prism//lib/prism/translation/parser/compiler.rb#1523 def visit_rational_node(node); end # redo # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2709 + # source://prism//lib/prism/translation/parser/compiler.rb#1529 def visit_redo_node(node); end # /foo/ # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2716 + # source://prism//lib/prism/translation/parser/compiler.rb#1535 def visit_regular_expression_node(node); end # def foo(bar:); end # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2738 + # source://prism//lib/prism/translation/parser/compiler.rb#1559 def visit_required_keyword_parameter_node(node); end # def foo(bar); end # ^^^ # - # source://prism//lib/prism/translation/ripper.rb#2745 + # source://prism//lib/prism/translation/parser/compiler.rb#1565 def visit_required_parameter_node(node); end # foo rescue bar # ^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2752 + # source://prism//lib/prism/translation/parser/compiler.rb#1571 def visit_rescue_modifier_node(node); end # begin; rescue; end # ^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2762 + # @raise [CompilationError] + # + # source://prism//lib/prism/translation/parser/compiler.rb#1589 def visit_rescue_node(node); end # def foo(*bar); end @@ -32979,13 +35235,13 @@ class Prism::Translation::Ripper < ::Prism::Compiler # def foo(*); end # ^ # - # source://prism//lib/prism/translation/ripper.rb#2820 + # source://prism//lib/prism/translation/parser/compiler.rb#1598 def visit_rest_parameter_node(node); end # retry # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2832 + # source://prism//lib/prism/translation/parser/compiler.rb#1604 def visit_retry_node(node); end # return @@ -32994,42 +35250,42 @@ class Prism::Translation::Ripper < ::Prism::Compiler # return 1 # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2842 + # source://prism//lib/prism/translation/parser/compiler.rb#1613 def visit_return_node(node); end # self # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2856 + # source://prism//lib/prism/translation/parser/compiler.rb#1625 def visit_self_node(node); end # A shareable constant. # - # source://prism//lib/prism/translation/ripper.rb#2862 + # source://prism//lib/prism/translation/parser/compiler.rb#1630 def visit_shareable_constant_node(node); end # class << self; end # ^^^^^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2868 + # source://prism//lib/prism/translation/parser/compiler.rb#1636 def visit_singleton_class_node(node); end # __ENCODING__ # ^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2878 + # source://prism//lib/prism/translation/parser/compiler.rb#1648 def visit_source_encoding_node(node); end # __FILE__ # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2885 + # source://prism//lib/prism/translation/parser/compiler.rb#1654 def visit_source_file_node(node); end # __LINE__ # ^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2892 + # source://prism//lib/prism/translation/parser/compiler.rb#1660 def visit_source_line_node(node); end # foo(*bar) @@ -33041,42 +35297,42 @@ class Prism::Translation::Ripper < ::Prism::Compiler # def foo(*); bar(*); end # ^ # - # source://prism//lib/prism/translation/ripper.rb#2905 + # source://prism//lib/prism/translation/parser/compiler.rb#1672 def visit_splat_node(node); end # A list of statements. # - # source://prism//lib/prism/translation/ripper.rb#2910 + # source://prism//lib/prism/translation/parser/compiler.rb#1685 def visit_statements_node(node); end # "foo" # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#2927 + # source://prism//lib/prism/translation/parser/compiler.rb#1691 def visit_string_node(node); end # super(foo) # ^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3059 + # source://prism//lib/prism/translation/parser/compiler.rb#1716 def visit_super_node(node); end # :foo # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3080 + # source://prism//lib/prism/translation/parser/compiler.rb#1739 def visit_symbol_node(node); end # true # ^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3104 + # source://prism//lib/prism/translation/parser/compiler.rb#1766 def visit_true_node(node); end # undef foo # ^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3111 + # source://prism//lib/prism/translation/parser/compiler.rb#1772 def visit_undef_node(node); end # unless foo; bar end @@ -33085,22 +35341,22 @@ class Prism::Translation::Ripper < ::Prism::Compiler # bar unless foo # ^^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3123 + # source://prism//lib/prism/translation/parser/compiler.rb#1781 def visit_unless_node(node); end # until foo; bar end - # ^^^^^^^^^^^^^^^^^ + # ^^^^^^^^^^^^^^^^^^ # # bar until foo # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3151 + # source://prism//lib/prism/translation/parser/compiler.rb#1811 def visit_until_node(node); end # case foo; when bar; end # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3175 + # source://prism//lib/prism/translation/parser/compiler.rb#1837 def visit_when_node(node); end # while foo; bar end @@ -33109,13 +35365,13 @@ class Prism::Translation::Ripper < ::Prism::Compiler # bar while foo # ^^^^^^^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3196 + # source://prism//lib/prism/translation/parser/compiler.rb#1855 def visit_while_node(node); end # `foo` # ^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3220 + # source://prism//lib/prism/translation/parser/compiler.rb#1881 def visit_x_string_node(node); end # yield @@ -33124,1591 +35380,4086 @@ class Prism::Translation::Ripper < ::Prism::Compiler # yield 1 # ^^^^^^^ # - # source://prism//lib/prism/translation/ripper.rb#3243 + # source://prism//lib/prism/translation/parser/compiler.rb#1907 def visit_yield_node(node); end private - # :stopdoc: + # Initialize a new compiler with the given option overrides, used to + # visit a subtree with the given options. # - # source://prism//lib/prism/translation/ripper.rb#3383 - def _dispatch_0; end - - # source://prism//lib/prism/translation/ripper.rb#3384 - def _dispatch_1(_); end + # source://prism//lib/prism/translation/parser/compiler.rb#1921 + def copy_compiler(forwarding: T.unsafe(nil), in_destructure: T.unsafe(nil), in_pattern: T.unsafe(nil)); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def _dispatch_2(_, _); end - - # source://prism//lib/prism/translation/ripper.rb#3386 - def _dispatch_3(_, _, _); end - - # source://prism//lib/prism/translation/ripper.rb#3387 - def _dispatch_4(_, _, _, _); end - - # source://prism//lib/prism/translation/ripper.rb#3388 - def _dispatch_5(_, _, _, _, _); end - - # source://prism//lib/prism/translation/ripper.rb#3389 - def _dispatch_7(_, _, _, _, _, _, _); end + # When *, **, &, or ... are used as an argument in a method call, we + # check if they were allowed by the current context. To determine that + # we build this lookup table. + # + # source://prism//lib/prism/translation/parser/compiler.rb#1928 + def find_forwarding(node); end - # This method is responsible for updating lineno and column information - # to reflect the current node. + # Returns the set of targets for a MultiTargetNode or a MultiWriteNode. # - # This method could be drastically improved with some caching on the start - # of every line, but for now it's good enough. + # source://prism//lib/prism/translation/parser/compiler.rb#1941 + def multi_target_elements(node); end + + # Negate the value of a numeric node. This is a special case where you + # have a negative sign on one line and then a number on the next line. + # In normal Ruby, this will always be a method call. The parser gem, + # however, marks this as a numeric literal. We have to massage the tree + # here to get it into the correct form. # - # source://prism//lib/prism/translation/ripper.rb#3373 - def bounds(location); end + # source://prism//lib/prism/translation/parser/compiler.rb#1953 + def numeric_negate(message_loc, receiver); end - # Returns true if the given node is a command node. + # Blocks can have a special set of parameters that automatically expand + # when given arrays if they have a single required parameter and no + # other parameters. # # @return [Boolean] # - # source://prism//lib/prism/translation/ripper.rb#1163 - def command?(node); end + # source://prism//lib/prism/translation/parser/compiler.rb#1967 + def procarg0?(parameters); end - # This method is called when the parser found syntax error. + # Constructs a new source range from the given start and end offsets. # - # source://prism//lib/prism/translation/ripper.rb#3411 - def compile_error(msg); end + # source://prism//lib/prism/translation/parser/compiler.rb#1984 + def srange(location); end - # This method is provided by the Ripper C extension. It is called when a - # string needs to be dedented because of a tilde heredoc. It is expected - # that it will modify the string in place and return the number of bytes - # that were removed. + # Constructs a new source range by finding the given character between + # the given start offset and end offset. If the needle is not found, it + # returns nil. Importantly it does not search past newlines or comments. # - # source://prism//lib/prism/translation/ripper.rb#3426 - def dedent_string(string, width); end - - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_BEGIN(_); end - - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_CHAR(_); end - - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_END(_); end + # Note that end_offset is allowed to be nil, in which case this will + # search until the end of the string. + # + # source://prism//lib/prism/translation/parser/compiler.rb#1999 + def srange_find(start_offset, end_offset, character); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on___end__(_); end + # Constructs a new source range from the given start and end offsets. + # + # source://prism//lib/prism/translation/parser/compiler.rb#1989 + def srange_offsets(start_offset, end_offset); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_alias(_, _); end + # When the content of a string node is split across multiple lines, the + # parser gem creates individual string nodes for each line the content is part of. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2116 + def string_nodes_from_interpolation(node, opening); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_alias_error(_, _); end + # Create parser string nodes from a single prism node. The parser gem + # "glues" strings together when a line continuation is encountered. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2128 + def string_nodes_from_line_continuations(unescaped, escaped, start_offset, opening); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_aref(_, _); end + # Transform a location into a token that the parser gem expects. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2007 + def token(location); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_aref_field(_, _); end + # Visit a block node on a call. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2012 + def visit_block(call, block); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_arg_ambiguous(_); end + # Visit a heredoc that can be either a string or an xstring. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2047 + def visit_heredoc(node); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_arg_paren(_); end + # Visit a numeric node and account for the optional sign. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2093 + def visit_numeric(node, value); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_args_add(_, _); end + # Within the given block, track that we're within a pattern. + # + # source://prism//lib/prism/translation/parser/compiler.rb#2105 + def within_pattern; end +end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_args_add_block(_, _); end +# Raised when the tree is malformed or there is a bug in the compiler. +# +# source://prism//lib/prism/translation/parser/compiler.rb#10 +class Prism::Translation::Parser::Compiler::CompilationError < ::StandardError; end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_args_add_star(_, _); end +# Locations in the parser gem AST are generated using this class. We +# store a reference to its constant to make it slightly faster to look +# up. +# +# source://prism//lib/prism/translation/parser/compiler.rb#1981 +Prism::Translation::Parser::Compiler::Range = Parser::Source::Range - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_args_forward; end +# source://prism//lib/prism/translation/parser.rb#17 +Prism::Translation::Parser::Diagnostic = Parser::Diagnostic - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_args_new; end +# Accepts a list of prism tokens and converts them into the expected +# format for the parser gem. +# +# source://prism//lib/prism/translation/parser/lexer.rb#11 +class Prism::Translation::Parser::Lexer + # Initialize the lexer with the given source buffer, prism tokens, and + # offset cache. + # + # @return [Lexer] a new instance of Lexer + # + # source://prism//lib/prism/translation/parser/lexer.rb#229 + def initialize(source_buffer, lexed, offset_cache); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_array(_); end + # An array of tuples that contain prism tokens and their associated lex + # state when they were lexed. + # + # source://prism//lib/prism/translation/parser/lexer.rb#222 + def lexed; end - # source://prism//lib/prism/translation/ripper.rb#3387 - def on_aryptn(_, _, _, _); end + # A hash that maps offsets in bytes to offsets in characters. + # + # source://prism//lib/prism/translation/parser/lexer.rb#225 + def offset_cache; end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_assign(_, _); end + # The Parser::Source::Buffer that the tokens were lexed from. + # + # source://prism//lib/prism/translation/parser/lexer.rb#218 + def source_buffer; end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_assign_error(_, _); end + # Convert the prism tokens into the expected format for the parser gem. + # + # source://prism//lib/prism/translation/parser/lexer.rb#239 + def to_a; end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_assoc_new(_, _); end + private - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_assoc_splat(_); end + # Wonky heredoc tab/spaces rules. + # https://github.com/ruby/prism/blob/v1.3.0/src/prism.c#L10548-L10558 + # + # source://prism//lib/prism/translation/parser/lexer.rb#585 + def calculate_heredoc_whitespace(heredoc_token_index); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_assoclist_from_args(_); end + # Escape a byte value, given the control and meta flags. + # + # source://prism//lib/prism/translation/parser/lexer.rb#727 + def escape_build(value, control, meta); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_backref(_); end + # Read an escape out of the string scanner, given the control and meta + # flags, and push the unescaped value into the result. + # + # source://prism//lib/prism/translation/parser/lexer.rb#735 + def escape_read(result, scanner, control, meta); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_backtick(_); end + # Determine if characters preceeded by a backslash should be escaped or not + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser/lexer.rb#796 + def interpolation?(quote); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_bare_assoc_hash(_); end + # Parse a complex from the string representation. + # + # source://prism//lib/prism/translation/parser/lexer.rb#556 + def parse_complex(value); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_begin(_); end + # Parse a float from the string representation. + # + # source://prism//lib/prism/translation/parser/lexer.rb#549 + def parse_float(value); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_binary(_, _, _); end + # Parse an integer from the string representation. + # + # source://prism//lib/prism/translation/parser/lexer.rb#542 + def parse_integer(value); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_block_var(_, _); end + # Parse a rational from the string representation. + # + # source://prism//lib/prism/translation/parser/lexer.rb#571 + def parse_rational(value); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_blockarg(_); end + # Determine if the string is part of a %-style array. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser/lexer.rb#806 + def percent_array?(quote); end - # source://prism//lib/prism/translation/ripper.rb#3387 - def on_bodystmt(_, _, _, _); end + # For %-arrays whitespace, the parser gem only considers whitespace before the newline. + # + # source://prism//lib/prism/translation/parser/lexer.rb#784 + def percent_array_leading_whitespace(string); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_brace_block(_, _); end + # In a percent array, certain whitespace can be preceeded with a backslash, + # causing the following characters to be part of the previous element. + # + # source://prism//lib/prism/translation/parser/lexer.rb#776 + def percent_array_unescape(string); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_break(_); end + # Creates a new parser range, taking prisms byte offsets into account + # + # source://prism//lib/prism/translation/parser/lexer.rb#537 + def range(start_offset, end_offset); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_call(_, _, _); end + # Regexp allow interpolation but are handled differently during unescaping + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser/lexer.rb#801 + def regexp?(quote); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_case(_, _); end + # Certain strings are merged into a single string token. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/parser/lexer.rb#710 + def simplify_string?(value, quote); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_class(_, _, _); end + # Wonky heredoc tab/spaces rules. + # https://github.com/ruby/prism/blob/v1.3.0/src/prism.c#L16528-L16545 + # + # source://prism//lib/prism/translation/parser/lexer.rb#632 + def trim_heredoc_whitespace(string, heredoc); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_class_name_error(_, _); end + # Apply Ruby string escaping rules + # + # source://prism//lib/prism/translation/parser/lexer.rb#667 + def unescape_string(string, quote); end +end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_comma(_); end +# Types of tokens that are allowed to continue a method call with comments in-between. +# For these, the parser gem doesn't emit a newline token after the last comment. +# +# source://prism//lib/prism/translation/parser/lexer.rb#209 +Prism::Translation::Parser::Lexer::COMMENT_CONTINUATION_TYPES = T.let(T.unsafe(nil), Set) - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_command(_, _); end +# When one of these delimiters is encountered, then the other +# one is allowed to be escaped as well. +# +# source://prism//lib/prism/translation/parser/lexer.rb#658 +Prism::Translation::Parser::Lexer::DELIMITER_SYMETRY = T.let(T.unsafe(nil), Hash) - # source://prism//lib/prism/translation/ripper.rb#3387 - def on_command_call(_, _, _, _); end +# Escape sequences that have special and should appear unescaped in the resulting string. +# +# source://prism//lib/prism/translation/parser/lexer.rb#649 +Prism::Translation::Parser::Lexer::ESCAPES = T.let(T.unsafe(nil), Hash) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_comment(_); end +# These constants represent flags in our lex state. We really, really +# don't want to be using them and we really, really don't want to be +# exposing them as part of our public API. Unfortunately, we don't have +# another way of matching the exact tokens that the parser gem expects +# without them. We should find another way to do this, but in the +# meantime we'll hide them from the documentation and mark them as +# private constants. +# +# source://prism//lib/prism/translation/parser/lexer.rb#191 +Prism::Translation::Parser::Lexer::EXPR_BEG = T.let(T.unsafe(nil), Integer) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_const(_); end +# source://prism//lib/prism/translation/parser/lexer.rb#192 +Prism::Translation::Parser::Lexer::EXPR_LABEL = T.let(T.unsafe(nil), Integer) - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_const_path_field(_, _); end +# Heredocs are complex and require us to keep track of a bit of info to refer to later +# +# source://prism//lib/prism/translation/parser/lexer.rb#213 +class Prism::Translation::Parser::Lexer::HeredocData < ::Struct + # Returns the value of attribute common_whitespace + # + # @return [Object] the current value of common_whitespace + def common_whitespace; end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_const_path_ref(_, _); end + # Sets the attribute common_whitespace + # + # @param value [Object] the value to set the attribute common_whitespace to. + # @return [Object] the newly set value + def common_whitespace=(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_const_ref(_); end + # Returns the value of attribute identifier + # + # @return [Object] the current value of identifier + def identifier; end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_cvar(_); end + # Sets the attribute identifier + # + # @param value [Object] the value to set the attribute identifier to. + # @return [Object] the newly set value + def identifier=(_); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_def(_, _, _); end + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_defined(_); end +# It is used to determine whether `do` is of the token type `kDO` or `kDO_LAMBDA`. +# +# NOTE: In edge cases like `-> (foo = -> (bar) {}) do end`, please note that `kDO` is still returned +# instead of `kDO_LAMBDA`, which is expected: https://github.com/ruby/prism/pull/3046 +# +# source://prism//lib/prism/translation/parser/lexer.rb#198 +Prism::Translation::Parser::Lexer::LAMBDA_TOKEN_TYPES = T.let(T.unsafe(nil), Set) - # source://prism//lib/prism/translation/ripper.rb#3388 - def on_defs(_, _, _, _, _); end +# The `PARENTHESIS_LEFT` token in Prism is classified as either `tLPAREN` or `tLPAREN2` in the Parser gem. +# The following token types are listed as those classified as `tLPAREN`. +# +# source://prism//lib/prism/translation/parser/lexer.rb#202 +Prism::Translation::Parser::Lexer::LPAREN_CONVERSION_TOKEN_TYPES = T.let(T.unsafe(nil), Set) - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_do_block(_, _); end +# https://github.com/whitequark/parser/blob/v3.3.6.0/lib/parser/lexer-strings.rl#L14 +# +# source://prism//lib/prism/translation/parser/lexer.rb#663 +Prism::Translation::Parser::Lexer::REGEXP_META_CHARACTERS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_dot2(_, _); end +# source://prism//lib/prism/translation/parser/lexer.rb#235 +Prism::Translation::Parser::Lexer::Range = Parser::Source::Range - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_dot3(_, _); end +# The direct translating of types between the two lexers. +# +# source://prism//lib/prism/translation/parser/lexer.rb#17 +Prism::Translation::Parser::Lexer::TYPES = T.let(T.unsafe(nil), Hash) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_dyna_symbol(_); end +# These tokens are always skipped +# +# source://prism//lib/prism/translation/parser/lexer.rb#13 +Prism::Translation::Parser::Lexer::TYPES_ALWAYS_SKIP = T.let(T.unsafe(nil), Set) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_else(_); end +# The parser gem has a list of diagnostics with a hard-coded set of error +# messages. We create our own diagnostic class in order to set our own +# error messages. +# +# source://prism//lib/prism/translation/parser.rb#23 +class Prism::Translation::Parser::PrismDiagnostic < ::Parser::Diagnostic + # Initialize a new diagnostic with the given message and location. + # + # @return [PrismDiagnostic] a new instance of PrismDiagnostic + # + # source://prism//lib/prism/translation/parser.rb#28 + def initialize(message, level, reason, location); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_elsif(_, _, _); end + # This is the cached message coming from prism. + # + # source://prism//lib/prism/translation/parser.rb#25 + def message; end +end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embdoc(_); end +# source://prism//lib/prism/translation/parser.rb#34 +Prism::Translation::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embdoc_beg(_); end +# This class provides a compatibility layer between prism and Ripper. It +# functions by parsing the entire tree first and then walking it and +# executing each of the Ripper callbacks as it goes. To use this class, you +# treat `Prism::Translation::Ripper` effectively as you would treat the +# `Ripper` class. +# +# Note that this class will serve the most common use cases, but Ripper's +# API is extensive and undocumented. It relies on reporting the state of the +# parser at any given time. We do our best to replicate that here, but +# because it is a different architecture it is not possible to perfectly +# replicate the behavior of Ripper. +# +# The main known difference is that we may omit dispatching some events in +# some cases. This impacts the following events: +# +# - on_assign_error +# - on_comma +# - on_ignored_nl +# - on_ignored_sp +# - on_kw +# - on_label_end +# - on_lbrace +# - on_lbracket +# - on_lparen +# - on_nl +# - on_op +# - on_operator_ambiguous +# - on_rbrace +# - on_rbracket +# - on_rparen +# - on_semicolon +# - on_sp +# - on_symbeg +# - on_tstring_beg +# - on_tstring_end +# +# source://prism//lib/prism/translation/ripper.rb#43 +class Prism::Translation::Ripper < ::Prism::Compiler + # Create a new Translation::Ripper object with the given source. + # + # @return [Ripper] a new instance of Ripper + # + # source://prism//lib/prism/translation/ripper.rb#444 + def initialize(source, filename = T.unsafe(nil), lineno = T.unsafe(nil)); end + + # The current column number of the parser. + # + # source://prism//lib/prism/translation/ripper.rb#441 + def column; end + + # True if the parser encountered an error during parsing. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/ripper.rb#457 + sig { returns(T::Boolean) } + def error?; end + + # The filename of the source being parsed. + # + # source://prism//lib/prism/translation/ripper.rb#435 + def filename; end + + # The current line number of the parser. + # + # source://prism//lib/prism/translation/ripper.rb#438 + def lineno; end + + # Parse the source and return the result. + # + # source://prism//lib/prism/translation/ripper.rb#462 + sig { returns(T.untyped) } + def parse; end + + # The source that is being parsed. + # + # source://prism//lib/prism/translation/ripper.rb#432 + def source; end + + # alias $foo $bar + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#561 + def visit_alias_global_variable_node(node); end + + # alias foo bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#551 + def visit_alias_method_node(node); end + + # foo => bar | baz + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#585 + def visit_alternation_pattern_node(node); end + + # a and b + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#605 + def visit_and_node(node); end + + # foo(bar) + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#796 + def visit_arguments_node(node); end + + # [] + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#615 + def visit_array_node(node); end + + # foo => [bar] + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#775 + def visit_array_pattern_node(node); end + + # { a: 1 } + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#803 + def visit_assoc_node(node); end + + # def foo(**); bar(**); end + # ^^ + # + # { **foo } + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#816 + def visit_assoc_splat_node(node); end + + # $+ + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#825 + def visit_back_reference_read_node(node); end + + # begin end + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#832 + def visit_begin_node(node); end + + # foo(&bar) + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#896 + def visit_block_argument_node(node); end + + # foo { |; bar| } + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#902 + def visit_block_local_variable_node(node); end + + # Visit a BlockNode. + # + # source://prism//lib/prism/translation/ripper.rb#908 + def visit_block_node(node); end + + # def foo(&bar); end + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#944 + def visit_block_parameter_node(node); end + + # A block's parameters. + # + # source://prism//lib/prism/translation/ripper.rb#958 + def visit_block_parameters_node(node); end + + # break + # ^^^^^ + # + # break foo + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#982 + def visit_break_node(node); end + + # foo.bar &&= baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1204 + def visit_call_and_write_node(node); end + + # foo + # ^^^ + # + # foo.bar + # ^^^^^^^ + # + # foo.bar() {} + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1002 + def visit_call_node(node); end + + # foo.bar += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1182 + def visit_call_operator_write_node(node); end + + # foo.bar ||= baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1226 + def visit_call_or_write_node(node); end + + # foo.bar, = 1 + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1248 + def visit_call_target_node(node); end + + # foo => bar => baz + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1273 + def visit_capture_pattern_node(node); end + + # case foo; in bar; end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1296 + def visit_case_match_node(node); end + + # case foo; when bar; end + # ^^^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1283 + def visit_case_node(node); end + + # class Foo; end + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1309 + def visit_class_node(node); end + + # @@foo &&= bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1362 + def visit_class_variable_and_write_node(node); end + + # @@foo += bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1348 + def visit_class_variable_operator_write_node(node); end + + # @@foo ||= bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1376 + def visit_class_variable_or_write_node(node); end + + # @@foo + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1327 + def visit_class_variable_read_node(node); end + + # @@foo, = bar + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1390 + def visit_class_variable_target_node(node); end + + # @@foo = 1 + # ^^^^^^^^^ + # + # @@foo, @@bar = 1 + # ^^^^^ ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1337 + def visit_class_variable_write_node(node); end + + # Foo &&= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1432 + def visit_constant_and_write_node(node); end + + # Foo += bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1418 + def visit_constant_operator_write_node(node); end + + # Foo ||= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1446 + def visit_constant_or_write_node(node); end + + # Foo::Bar &&= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1533 + def visit_constant_path_and_write_node(node); end + + # Foo::Bar + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1467 + def visit_constant_path_node(node); end + + # Foo::Bar += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1519 + def visit_constant_path_operator_write_node(node); end + + # Foo::Bar ||= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1547 + def visit_constant_path_or_write_node(node); end + + # Foo::Bar, = baz + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1561 + def visit_constant_path_target_node(node); end + + # Foo::Bar = 1 + # ^^^^^^^^^^^^ + # + # Foo::Foo, Bar::Bar = 1 + # ^^^^^^^^ ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1490 + def visit_constant_path_write_node(node); end + + # Foo + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1397 + def visit_constant_read_node(node); end + + # Foo, = bar + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1460 + def visit_constant_target_node(node); end + + # Foo = 1 + # ^^^^^^^ + # + # Foo, Bar = 1 + # ^^^ ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1407 + def visit_constant_write_node(node); end + + # def foo; end + # ^^^^^^^^^^^^ + # + # def self.foo; end + # ^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1570 + def visit_def_node(node); end + + # defined? a + # ^^^^^^^^^^ + # + # defined?(a) + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1617 + def visit_defined_node(node); end + + # if foo then bar else baz end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1624 + def visit_else_node(node); end + + # "foo #{bar}" + # ^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1640 + def visit_embedded_statements_node(node); end + + # "foo #@bar" + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1661 + def visit_embedded_variable_node(node); end + + # Visit an EnsureNode node. + # + # source://prism//lib/prism/translation/ripper.rb#1672 + def visit_ensure_node(node); end + + # false + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1690 + def visit_false_node(node); end + + # foo => [*, bar, *] + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1697 + def visit_find_pattern_node(node); end + + # if foo .. bar; end + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1722 + def visit_flip_flop_node(node); end + + # 1.0 + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1736 + def visit_float_node(node); end + + # for foo in bar do end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1742 + def visit_for_node(node); end + + # def foo(...); bar(...); end + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1759 + def visit_forwarding_arguments_node(node); end + + # def foo(...); end + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1766 + def visit_forwarding_parameter_node(node); end + + # super + # ^^^^^ + # + # super {} + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1776 + def visit_forwarding_super_node(node); end + + # $foo &&= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1825 + def visit_global_variable_and_write_node(node); end + + # $foo += bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1811 + def visit_global_variable_operator_write_node(node); end + + # $foo ||= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1839 + def visit_global_variable_or_write_node(node); end + + # $foo + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1790 + def visit_global_variable_read_node(node); end + + # $foo, = bar + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1853 + def visit_global_variable_target_node(node); end + + # $foo = 1 + # ^^^^^^^^ + # + # $foo, $bar = 1 + # ^^^^ ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1800 + def visit_global_variable_write_node(node); end + + # {} + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#1860 + def visit_hash_node(node); end + + # foo => {} + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#1875 + def visit_hash_pattern_node(node); end + + # if foo then bar end + # ^^^^^^^^^^^^^^^^^^^ + # + # bar if foo + # ^^^^^^^^^^ + # + # foo ? bar : baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1917 + def visit_if_node(node); end + + # 1i + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#1953 + def visit_imaginary_node(node); end + + # { foo: } + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1959 + def visit_implicit_node(node); end + + # foo { |bar,| } + # ^ + # + # source://prism//lib/prism/translation/ripper.rb#1964 + def visit_implicit_rest_node(node); end + + # case foo; in bar; end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1971 + def visit_in_node(node); end + + # foo[bar] &&= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2006 + def visit_index_and_write_node(node); end + + # foo[bar] += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#1989 + def visit_index_operator_write_node(node); end + + # foo[bar] ||= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2023 + def visit_index_or_write_node(node); end + + # foo[bar], = 1 + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2040 + def visit_index_target_node(node); end + + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2082 + def visit_instance_variable_and_write_node(node); end + + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2068 + def visit_instance_variable_operator_write_node(node); end + + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2096 + def visit_instance_variable_or_write_node(node); end + + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2050 + def visit_instance_variable_read_node(node); end + + # @foo, = bar + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2110 + def visit_instance_variable_target_node(node); end + + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2057 + def visit_instance_variable_write_node(node); end + + # 1 + # ^ + # + # source://prism//lib/prism/translation/ripper.rb#2117 + def visit_integer_node(node); end + + # if /foo #{bar}/ then end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2123 + def visit_interpolated_match_last_line_node(node); end + + # /foo #{bar}/ + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2142 + def visit_interpolated_regular_expression_node(node); end + + # "foo #{bar}" + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2161 + def visit_interpolated_string_node(node); end + + # :"foo #{bar}" + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2189 + def visit_interpolated_symbol_node(node); end + + # `foo #{bar}` + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2202 + def visit_interpolated_x_string_node(node); end + + # -> { it } + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#2232 + def visit_it_local_variable_read_node(node); end + + # -> { it } + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2239 + def visit_it_parameters_node(node); end + + # foo(bar: baz) + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2244 + def visit_keyword_hash_node(node); end + + # def foo(**bar); end + # ^^^^^ + # + # def foo(**); end + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#2256 + def visit_keyword_rest_parameter_node(node); end + + # -> {} + # + # source://prism//lib/prism/translation/ripper.rb#2270 + def visit_lambda_node(node); end + + # foo &&= bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2362 + def visit_local_variable_and_write_node(node); end + + # foo += bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2348 + def visit_local_variable_operator_write_node(node); end + + # foo ||= bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2376 + def visit_local_variable_or_write_node(node); end + + # foo + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2330 + def visit_local_variable_read_node(node); end + + # foo, = bar + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2390 + def visit_local_variable_target_node(node); end + + # foo = 1 + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2337 + def visit_local_variable_write_node(node); end + + # if /foo/ then end + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2397 + def visit_match_last_line_node(node); end + + # foo in bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2412 + def visit_match_predicate_node(node); end + + # foo => bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2421 + def visit_match_required_node(node); end + + # /(?foo)/ =~ bar + # ^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2430 + def visit_match_write_node(node); end + + # A node that is missing from the syntax tree. This is only used in the + # case of a syntax error. + # + # source://prism//lib/prism/translation/ripper.rb#2436 + def visit_missing_node(node); end + + # module Foo; end + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2442 + def visit_module_node(node); end + + # (foo, bar), bar = qux + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2459 + def visit_multi_target_node(node); end + + # foo, bar = baz + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2513 + def visit_multi_write_node(node); end + + # next + # ^^^^ + # + # next foo + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2533 + def visit_next_node(node); end + + # nil + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2547 + def visit_nil_node(node); end + + # def foo(**nil); end + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2554 + def visit_no_keywords_parameter_node(node); end + + # -> { _1 + _2 } + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2563 + def visit_numbered_parameters_node(node); end + + # $1 + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#2568 + def visit_numbered_reference_read_node(node); end + + # def foo(bar: baz); end + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2575 + def visit_optional_keyword_parameter_node(node); end + + # def foo(bar = 1); end + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2585 + def visit_optional_parameter_node(node); end + + # a or b + # ^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2595 + def visit_or_node(node); end + + # def foo(bar, *baz); end + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2605 + def visit_parameters_node(node); end + + # () + # ^^ + # + # (1) + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2632 + def visit_parentheses_node(node); end + + # foo => ^(bar) + # ^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2646 + def visit_pinned_expression_node(node); end + + # foo = 1 and bar => ^foo + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2655 + def visit_pinned_variable_node(node); end + + # END {} + # ^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2661 + def visit_post_execution_node(node); end + + # BEGIN {} + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2676 + def visit_pre_execution_node(node); end + + # The top-level program node. + # + # source://prism//lib/prism/translation/ripper.rb#2690 + def visit_program_node(node); end + + # 0..5 + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2701 + def visit_range_node(node); end + + # 1r + # ^^ + # + # source://prism//lib/prism/translation/ripper.rb#2715 + def visit_rational_node(node); end + + # redo + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2721 + def visit_redo_node(node); end + + # /foo/ + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2728 + def visit_regular_expression_node(node); end + + # def foo(bar:); end + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2750 + def visit_required_keyword_parameter_node(node); end + + # def foo(bar); end + # ^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2757 + def visit_required_parameter_node(node); end + + # foo rescue bar + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2764 + def visit_rescue_modifier_node(node); end + + # begin; rescue; end + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2774 + def visit_rescue_node(node); end + + # def foo(*bar); end + # ^^^^ + # + # def foo(*); end + # ^ + # + # source://prism//lib/prism/translation/ripper.rb#2832 + def visit_rest_parameter_node(node); end + + # retry + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2844 + def visit_retry_node(node); end + + # return + # ^^^^^^ + # + # return 1 + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2854 + def visit_return_node(node); end + + # self + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2868 + def visit_self_node(node); end + + # A shareable constant. + # + # source://prism//lib/prism/translation/ripper.rb#2874 + def visit_shareable_constant_node(node); end + + # class << self; end + # ^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2880 + def visit_singleton_class_node(node); end + + # __ENCODING__ + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2890 + def visit_source_encoding_node(node); end + + # __FILE__ + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2897 + def visit_source_file_node(node); end + + # __LINE__ + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2904 + def visit_source_line_node(node); end + + # foo(*bar) + # ^^^^ + # + # def foo((bar, *baz)); end + # ^^^^ + # + # def foo(*); bar(*); end + # ^ + # + # source://prism//lib/prism/translation/ripper.rb#2917 + def visit_splat_node(node); end + + # A list of statements. + # + # source://prism//lib/prism/translation/ripper.rb#2922 + def visit_statements_node(node); end + + # "foo" + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#2939 + def visit_string_node(node); end + + # super(foo) + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3071 + def visit_super_node(node); end + + # :foo + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3092 + def visit_symbol_node(node); end + + # true + # ^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3116 + def visit_true_node(node); end + + # undef foo + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3123 + def visit_undef_node(node); end + + # unless foo; bar end + # ^^^^^^^^^^^^^^^^^^^ + # + # bar unless foo + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3135 + def visit_unless_node(node); end + + # until foo; bar end + # ^^^^^^^^^^^^^^^^^ + # + # bar until foo + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3163 + def visit_until_node(node); end + + # case foo; when bar; end + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3187 + def visit_when_node(node); end + + # while foo; bar end + # ^^^^^^^^^^^^^^^^^^ + # + # bar while foo + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3208 + def visit_while_node(node); end + + # `foo` + # ^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3232 + def visit_x_string_node(node); end + + # yield + # ^^^^^ + # + # yield 1 + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ripper.rb#3255 + def visit_yield_node(node); end + + private + + # :stopdoc: + # + # source://prism//lib/prism/translation/ripper.rb#3395 + def _dispatch_0; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def _dispatch_1(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def _dispatch_2(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def _dispatch_3(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def _dispatch_4(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3400 + def _dispatch_5(_, _, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3401 + def _dispatch_7(_, _, _, _, _, _, _); end + + # This method is responsible for updating lineno and column information + # to reflect the current node. + # + # This method could be drastically improved with some caching on the start + # of every line, but for now it's good enough. + # + # source://prism//lib/prism/translation/ripper.rb#3385 + def bounds(location); end + + # Returns true if the given node is a command node. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/ripper.rb#1173 + def command?(node); end + + # This method is called when the parser found syntax error. + # + # source://prism//lib/prism/translation/ripper.rb#3423 + def compile_error(msg); end + + # This method is provided by the Ripper C extension. It is called when a + # string needs to be dedented because of a tilde heredoc. It is expected + # that it will modify the string in place and return the number of bytes + # that were removed. + # + # source://prism//lib/prism/translation/ripper.rb#3438 + def dedent_string(string, width); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_BEGIN(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_CHAR(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_END(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on___end__(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_alias(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_alias_error(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_aref(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_aref_field(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_arg_ambiguous(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_arg_paren(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_args_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_args_add_block(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_args_add_star(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_args_forward; end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_args_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_array(_); end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def on_aryptn(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_assign(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_assign_error(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_assoc_new(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_assoc_splat(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_assoclist_from_args(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_backref(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_backtick(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_bare_assoc_hash(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_begin(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_binary(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_block_var(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_blockarg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def on_bodystmt(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_brace_block(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_break(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_call(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_case(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_class(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_class_name_error(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_comma(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_command(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def on_command_call(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_comment(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_const(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_const_path_field(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_const_path_ref(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_const_ref(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_cvar(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_def(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_defined(_); end + + # source://prism//lib/prism/translation/ripper.rb#3400 + def on_defs(_, _, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_do_block(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_dot2(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_dot3(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_dyna_symbol(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_else(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_elsif(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embdoc(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embdoc_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embdoc_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embexpr_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embexpr_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_embvar(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_ensure(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_excessed_comma; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_fcall(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_field(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_float(_); end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def on_fndptn(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_for(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_gvar(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_hash(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_heredoc_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_heredoc_dedent(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_heredoc_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_hshptn(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_ident(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_if(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_if_mod(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_ifop(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_ignored_nl(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_ignored_sp(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_imaginary(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_in(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_int(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_ivar(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_kw(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_kwrest_param(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_label(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_label_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_lambda(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_lbrace(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_lbracket(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_lparen(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_magic_comment(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_massign(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_method_add_arg(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_method_add_block(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_mlhs_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_mlhs_add_post(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_mlhs_add_star(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_mlhs_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_mlhs_paren(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_module(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_mrhs_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_mrhs_add_star(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_mrhs_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_mrhs_new_from_args(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_next(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_nl(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_nokw_param(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_op(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_opassign(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_operator_ambiguous(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_param_error(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3401 + def on_params(_, _, _, _, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_paren(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_parse_error(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_period(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_program(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_qsymbols_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_qsymbols_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_qsymbols_new; end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_qwords_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_qwords_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_qwords_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_rational(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_rbrace(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_rbracket(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_redo; end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_regexp_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_regexp_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_regexp_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_regexp_literal(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_regexp_new; end + + # source://prism//lib/prism/translation/ripper.rb#3399 + def on_rescue(_, _, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_rescue_mod(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_rest_param(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_retry; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_return(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_return0; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_rparen(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_sclass(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_semicolon(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_sp(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_stmts_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_stmts_new; end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_string_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_string_concat(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_string_content; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_string_dvar(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_string_embexpr(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embdoc_end(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_string_literal(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embexpr_beg(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_super(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embexpr_end(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_symbeg(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_embvar(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_symbol(_); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_ensure(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_symbol_literal(_); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_excessed_comma; end + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_symbols_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_fcall(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_symbols_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_field(_, _, _); end + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_symbols_new; end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_float(_); end + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_tlambda(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_tlambeg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_top_const_field(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_top_const_ref(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_tstring_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_tstring_content(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_tstring_end(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_unary(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_undef(_); end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_unless(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_unless_mod(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_until(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_until_mod(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_var_alias(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_var_field(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_var_ref(_); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_vcall(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_void_stmt; end + + # source://prism//lib/prism/translation/ripper.rb#3398 + def on_when(_, _, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_while(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_while_mod(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_word_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_word_new; end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_words_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_words_beg(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_words_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_words_sep(_); end + + # source://prism//lib/prism/translation/ripper.rb#3397 + def on_xstring_add(_, _); end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_xstring_literal(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_xstring_new; end + + # source://prism//lib/prism/translation/ripper.rb#3396 + def on_yield(_); end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_yield0; end + + # source://prism//lib/prism/translation/ripper.rb#3395 + def on_zsuper; end + + # Lazily initialize the parse result. + # + # source://prism//lib/prism/translation/ripper.rb#3281 + def result; end + + # Returns true if there is a comma between the two locations. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/ripper.rb#3290 + def trailing_comma?(left, right); end + + # Visit one side of an alias global variable node. + # + # source://prism//lib/prism/translation/ripper.rb#570 + def visit_alias_global_variable_node_value(node); end + + # Visit a list of elements, like the elements of an array or arguments. + # + # source://prism//lib/prism/translation/ripper.rb#756 + def visit_arguments(elements); end + + # Visit the clauses of a begin node to form an on_bodystmt call. + # + # source://prism//lib/prism/translation/ripper.rb#840 + def visit_begin_node_clauses(location, node, allow_newline); end + + # Visit the body of a structure that can have either a set of statements + # or statements wrapped in rescue/else/ensure. + # + # source://prism//lib/prism/translation/ripper.rb#875 + def visit_body_node(location, node, allow_newline = T.unsafe(nil)); end + + # Visit the arguments and block of a call node and return the arguments + # and block as they should be used. + # + # source://prism//lib/prism/translation/ripper.rb#1146 + def visit_call_node_arguments(arguments_node, block_node, trailing_comma); end + + # Visit a constant path that is part of a write node. + # + # source://prism//lib/prism/translation/ripper.rb#1499 + def visit_constant_path_write_node_target(node); end + + # Visit a destructured positional parameter node. + # + # source://prism//lib/prism/translation/ripper.rb#2619 + def visit_destructured_parameter_node(node); end + + # Visit a string that is expressed using a <<~ heredoc. + # + # source://prism//lib/prism/translation/ripper.rb#2990 + def visit_heredoc_node(parts, base); end + + # Ripper gives back the escaped string content but strips out the common + # leading whitespace. Prism gives back the unescaped string content and + # a location for the escaped string content. Unfortunately these don't + # work well together, so here we need to re-derive the common leading + # whitespace. + # + # source://prism//lib/prism/translation/ripper.rb#2965 + def visit_heredoc_node_whitespace(parts); end + + # Visit a heredoc node that is representing a string. + # + # source://prism//lib/prism/translation/ripper.rb#3036 + def visit_heredoc_string_node(node); end + + # Visit a heredoc node that is representing an xstring. + # + # source://prism//lib/prism/translation/ripper.rb#3053 + def visit_heredoc_x_string_node(node); end + + # Visit the targets of a multi-target node. + # + # source://prism//lib/prism/translation/ripper.rb#2472 + def visit_multi_target_node_targets(lefts, rest, rights, skippable); end + + # Visit a node that represents a number. We need to explicitly handle the + # unary - operator. + # + # source://prism//lib/prism/translation/ripper.rb#3329 + def visit_number_node(node); end + + # Visit a pattern within a pattern match. This is used to bypass the + # parenthesis node that can be used to wrap patterns. + # + # source://prism//lib/prism/translation/ripper.rb#595 + def visit_pattern_node(node); end + + # Visit the list of statements of a statements node. We support nil + # statements in the list. This would normally not be allowed by the + # structure of the prism parse tree, but we manually add them here so that + # we can mirror Ripper's void stmt. + # + # source://prism//lib/prism/translation/ripper.rb#2931 + def visit_statements_node_body(body); end + + # Visit an individual part of a string-like node. + # + # source://prism//lib/prism/translation/ripper.rb#2221 + def visit_string_content(part); end + + # Visit the string content of a particular node. This method is used to + # split into the various token types. + # + # source://prism//lib/prism/translation/ripper.rb#3302 + def visit_token(token, allow_keywords = T.unsafe(nil)); end + + # Dispatch a words_sep event that contains the space between the elements + # of list literals. + # + # source://prism//lib/prism/translation/ripper.rb#745 + def visit_words_sep(opening_loc, previous, current); end + + # Visit a node that represents a write value. This is used to handle the + # special case of an implicit array that is generated without brackets. + # + # source://prism//lib/prism/translation/ripper.rb#3347 + def visit_write_value(node); end + + # Returns true if there is a semicolon between the two locations. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/ripper.rb#3295 + def void_stmt?(left, right, allow_newline); end + + # This method is called when weak warning is produced by the parser. + # +fmt+ and +args+ is printf style. + # + # source://prism//lib/prism/translation/ripper.rb#3414 + def warn(fmt, *args); end + + # This method is called when strong warning is produced by the parser. + # +fmt+ and +args+ is printf style. + # + # source://prism//lib/prism/translation/ripper.rb#3419 + def warning(fmt, *args); end + + class << self + # Tokenizes the Ruby program and returns an array of an array, + # which is formatted like + # [[lineno, column], type, token, state]. + # The +filename+ argument is mostly ignored. + # By default, this method does not handle syntax errors in +src+, + # use the +raise_errors+ keyword to raise a SyntaxError for an error in +src+. + # + # require "ripper" + # require "pp" + # + # pp Ripper.lex("def m(a) nil end") + # #=> [[[1, 0], :on_kw, "def", FNAME ], + # [[1, 3], :on_sp, " ", FNAME ], + # [[1, 4], :on_ident, "m", ENDFN ], + # [[1, 5], :on_lparen, "(", BEG|LABEL], + # [[1, 6], :on_ident, "a", ARG ], + # [[1, 7], :on_rparen, ")", ENDFN ], + # [[1, 8], :on_sp, " ", BEG ], + # [[1, 9], :on_kw, "nil", END ], + # [[1, 12], :on_sp, " ", END ], + # [[1, 13], :on_kw, "end", END ]] + # + # source://prism//lib/prism/translation/ripper.rb#72 + def lex(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end + + # Parses the given Ruby program read from +src+. + # +src+ must be a String or an IO or a object with a #gets method. + # + # source://prism//lib/prism/translation/ripper.rb#46 + def parse(src, filename = T.unsafe(nil), lineno = T.unsafe(nil)); end + + # Parses +src+ and create S-exp tree. + # Returns more readable tree rather than Ripper.sexp_raw. + # This method is mainly for developer use. + # The +filename+ argument is mostly ignored. + # By default, this method does not handle syntax errors in +src+, + # returning +nil+ in such cases. Use the +raise_errors+ keyword + # to raise a SyntaxError for an error in +src+. + # + # require "ripper" + # require "pp" + # + # pp Ripper.sexp("def m(a) nil end") + # #=> [:program, + # [[:def, + # [:@ident, "m", [1, 4]], + # [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil, nil, nil, nil]], + # [:bodystmt, [[:var_ref, [:@kw, "nil", [1, 9]]]], nil, nil, nil]]]] + # + # source://prism//lib/prism/translation/ripper.rb#381 + def sexp(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end - # source://prism//lib/prism/translation/ripper.rb#3387 - def on_fndptn(_, _, _, _); end + # Parses +src+ and create S-exp tree. + # This method is mainly for developer use. + # The +filename+ argument is mostly ignored. + # By default, this method does not handle syntax errors in +src+, + # returning +nil+ in such cases. Use the +raise_errors+ keyword + # to raise a SyntaxError for an error in +src+. + # + # require "ripper" + # require "pp" + # + # pp Ripper.sexp_raw("def m(a) nil end") + # #=> [:program, + # [:stmts_add, + # [:stmts_new], + # [:def, + # [:@ident, "m", [1, 4]], + # [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil]], + # [:bodystmt, + # [:stmts_add, [:stmts_new], [:var_ref, [:@kw, "nil", [1, 9]]]], + # nil, + # nil, + # nil]]]] + # + # source://prism//lib/prism/translation/ripper.rb#416 + def sexp_raw(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end + end +end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_for(_, _, _); end +# A list of all of the Ruby binary operators. +# +# source://prism//lib/prism/translation/ripper.rb#337 +Prism::Translation::Ripper::BINARY_OPERATORS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_gvar(_); end +# This array contains name of all ripper events. +# +# source://prism//lib/prism/translation/ripper.rb#289 +Prism::Translation::Ripper::EVENTS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_hash(_); end +# A list of all of the Ruby keywords. +# +# source://prism//lib/prism/translation/ripper.rb#292 +Prism::Translation::Ripper::KEYWORDS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_heredoc_beg(_); end +# This array contains name of parser events. +# +# source://prism//lib/prism/translation/ripper.rb#283 +Prism::Translation::Ripper::PARSER_EVENTS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_heredoc_dedent(_, _); end +# This contains a table of all of the parser events and their +# corresponding arity. +# +# source://prism//lib/prism/translation/ripper.rb#84 +Prism::Translation::Ripper::PARSER_EVENT_TABLE = T.let(T.unsafe(nil), Hash) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_heredoc_end(_); end +# This array contains name of scanner events. +# +# source://prism//lib/prism/translation/ripper.rb#286 +Prism::Translation::Ripper::SCANNER_EVENTS = T.let(T.unsafe(nil), Array) - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_hshptn(_, _, _); end +# This contains a table of all of the scanner events and their +# corresponding arity. +# +# source://prism//lib/prism/translation/ripper.rb#227 +Prism::Translation::Ripper::SCANNER_EVENT_TABLE = T.let(T.unsafe(nil), Hash) - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_ident(_); end +# This class mirrors the ::Ripper::SexpBuilder subclass of ::Ripper that +# returns the arrays of [type, *children]. +# +# source://prism//lib/prism/translation/ripper/sexp.rb#10 +class Prism::Translation::Ripper::SexpBuilder < ::Prism::Translation::Ripper + # :stopdoc: + # + # source://prism//lib/prism/translation/ripper/sexp.rb#13 + def error; end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_if(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_BEGIN(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_if_mod(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_CHAR(tok); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_ifop(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_END(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_ignored_nl(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on___end__(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_ignored_sp(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_alias(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_imaginary(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_alias_error(*args); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_in(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_aref(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_int(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_aref_field(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_ivar(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_arg_ambiguous(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_kw(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_arg_paren(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_kwrest_param(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_args_add(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_label(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_args_add_block(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_label_end(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_args_add_star(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_lambda(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_args_forward(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_lbrace(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_args_new(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_lbracket(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_array(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_lparen(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_aryptn(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_magic_comment(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_assign(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_massign(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_assign_error(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_method_add_arg(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_assoc_new(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_method_add_block(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_assoc_splat(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_mlhs_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_assoclist_from_args(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_mlhs_add_post(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_backref(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_mlhs_add_star(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_backtick(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_mlhs_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_bare_assoc_hash(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_mlhs_paren(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_begin(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_module(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_binary(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_mrhs_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_block_var(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_mrhs_add_star(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_blockarg(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_mrhs_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_bodystmt(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_mrhs_new_from_args(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_brace_block(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_next(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_break(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_nl(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_call(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_nokw_param(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_case(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_op(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_class(*args); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_opassign(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_class_name_error(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_operator_ambiguous(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_comma(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_param_error(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_command(*args); end - # source://prism//lib/prism/translation/ripper.rb#3389 - def on_params(_, _, _, _, _, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_command_call(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_paren(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_comment(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_parse_error(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_const(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_period(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_const_path_field(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_program(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_const_path_ref(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_qsymbols_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_const_ref(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_qsymbols_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_cvar(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_qsymbols_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_def(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_qwords_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_defined(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_qwords_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_defs(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_qwords_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_do_block(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_rational(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_dot2(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_rbrace(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_dot3(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_rbracket(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_dyna_symbol(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_redo; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_else(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_regexp_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_elsif(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_regexp_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embdoc(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_regexp_end(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embdoc_beg(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_regexp_literal(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embdoc_end(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_regexp_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embexpr_beg(tok); end - # source://prism//lib/prism/translation/ripper.rb#3387 - def on_rescue(_, _, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embexpr_end(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_rescue_mod(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_embvar(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_rest_param(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_ensure(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_retry; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_excessed_comma(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_return(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_fcall(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_return0; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_field(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_rparen(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_float(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_sclass(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_fndptn(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_semicolon(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_for(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_sp(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_gvar(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_stmts_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_hash(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_stmts_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_heredoc_beg(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_string_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_heredoc_end(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_string_concat(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_hshptn(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_string_content; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_ident(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_string_dvar(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_if(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_string_embexpr(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_if_mod(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_string_literal(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_ifop(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_super(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_ignored_nl(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_symbeg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_ignored_sp(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_symbol(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_imaginary(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_symbol_literal(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_in(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_symbols_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_int(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_symbols_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_ivar(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_symbols_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_kw(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_tlambda(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_kwrest_param(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_tlambeg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_label(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_top_const_field(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_label_end(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_top_const_ref(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_lambda(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_tstring_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_lbrace(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_tstring_content(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_lbracket(tok); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_tstring_end(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_lparen(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_unary(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_magic_comment(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_undef(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_massign(*args); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_unless(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_method_add_arg(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_unless_mod(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_method_add_block(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_until(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mlhs_add(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_until_mod(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mlhs_add_post(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_var_alias(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mlhs_add_star(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_var_field(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mlhs_new(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_var_ref(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mlhs_paren(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_vcall(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_module(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_void_stmt; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mrhs_add(*args); end - # source://prism//lib/prism/translation/ripper.rb#3386 - def on_when(_, _, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mrhs_add_star(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_while(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mrhs_new(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_while_mod(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_mrhs_new_from_args(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_word_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_next(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_word_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_nl(tok); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_words_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_nokw_param(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_words_beg(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_op(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_words_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_opassign(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_words_sep(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_operator_ambiguous(*args); end - # source://prism//lib/prism/translation/ripper.rb#3385 - def on_xstring_add(_, _); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_param_error(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_xstring_literal(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_params(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_xstring_new; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_paren(*args); end - # source://prism//lib/prism/translation/ripper.rb#3384 - def on_yield(_); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_period(tok); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_yield0; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_program(*args); end - # source://prism//lib/prism/translation/ripper.rb#3383 - def on_zsuper; end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_qsymbols_add(*args); end - # Lazily initialize the parse result. - # - # source://prism//lib/prism/translation/ripper.rb#3269 - def result; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_qsymbols_beg(tok); end - # Returns true if there is a comma between the two locations. - # - # @return [Boolean] - # - # source://prism//lib/prism/translation/ripper.rb#3278 - def trailing_comma?(left, right); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_qsymbols_new(*args); end - # Visit one side of an alias global variable node. - # - # source://prism//lib/prism/translation/ripper.rb#570 - def visit_alias_global_variable_node_value(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_qwords_add(*args); end - # Visit a list of elements, like the elements of an array or arguments. - # - # source://prism//lib/prism/translation/ripper.rb#756 - def visit_arguments(elements); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_qwords_beg(tok); end - # Visit the clauses of a begin node to form an on_bodystmt call. - # - # source://prism//lib/prism/translation/ripper.rb#840 - def visit_begin_node_clauses(location, node, allow_newline); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_qwords_new(*args); end - # Visit the body of a structure that can have either a set of statements - # or statements wrapped in rescue/else/ensure. - # - # source://prism//lib/prism/translation/ripper.rb#875 - def visit_body_node(location, node, allow_newline = T.unsafe(nil)); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_rational(tok); end - # Visit the arguments and block of a call node and return the arguments - # and block as they should be used. - # - # source://prism//lib/prism/translation/ripper.rb#1136 - def visit_call_node_arguments(arguments_node, block_node, trailing_comma); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_rbrace(tok); end - # Visit a constant path that is part of a write node. - # - # source://prism//lib/prism/translation/ripper.rb#1489 - def visit_constant_path_write_node_target(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_rbracket(tok); end - # Visit a destructured positional parameter node. - # - # source://prism//lib/prism/translation/ripper.rb#2607 - def visit_destructured_parameter_node(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_redo(*args); end - # Visit a string that is expressed using a <<~ heredoc. - # - # source://prism//lib/prism/translation/ripper.rb#2978 - def visit_heredoc_node(parts, base); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_regexp_add(*args); end - # Ripper gives back the escaped string content but strips out the common - # leading whitespace. Prism gives back the unescaped string content and - # a location for the escaped string content. Unfortunately these don't - # work well together, so here we need to re-derive the common leading - # whitespace. - # - # source://prism//lib/prism/translation/ripper.rb#2953 - def visit_heredoc_node_whitespace(parts); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_regexp_beg(tok); end - # Visit a heredoc node that is representing a string. - # - # source://prism//lib/prism/translation/ripper.rb#3024 - def visit_heredoc_string_node(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_regexp_end(tok); end - # Visit a heredoc node that is representing an xstring. - # - # source://prism//lib/prism/translation/ripper.rb#3041 - def visit_heredoc_x_string_node(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_regexp_literal(*args); end - # Visit the targets of a multi-target node. - # - # source://prism//lib/prism/translation/ripper.rb#2460 - def visit_multi_target_node_targets(lefts, rest, rights, skippable); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_regexp_new(*args); end - # Visit a node that represents a number. We need to explicitly handle the - # unary - operator. - # - # source://prism//lib/prism/translation/ripper.rb#3317 - def visit_number_node(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_rescue(*args); end - # Visit a pattern within a pattern match. This is used to bypass the - # parenthesis node that can be used to wrap patterns. - # - # source://prism//lib/prism/translation/ripper.rb#595 - def visit_pattern_node(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_rescue_mod(*args); end - # Visit the list of statements of a statements node. We support nil - # statements in the list. This would normally not be allowed by the - # structure of the prism parse tree, but we manually add them here so that - # we can mirror Ripper's void stmt. - # - # source://prism//lib/prism/translation/ripper.rb#2919 - def visit_statements_node_body(body); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_rest_param(*args); end - # Visit an individual part of a string-like node. - # - # source://prism//lib/prism/translation/ripper.rb#2211 - def visit_string_content(part); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_retry(*args); end - # Visit the string content of a particular node. This method is used to - # split into the various token types. - # - # source://prism//lib/prism/translation/ripper.rb#3290 - def visit_token(token, allow_keywords = T.unsafe(nil)); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_return(*args); end - # Dispatch a words_sep event that contains the space between the elements - # of list literals. - # - # source://prism//lib/prism/translation/ripper.rb#745 - def visit_words_sep(opening_loc, previous, current); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_return0(*args); end - # Visit a node that represents a write value. This is used to handle the - # special case of an implicit array that is generated without brackets. - # - # source://prism//lib/prism/translation/ripper.rb#3335 - def visit_write_value(node); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_rparen(tok); end - # Returns true if there is a semicolon between the two locations. - # - # @return [Boolean] - # - # source://prism//lib/prism/translation/ripper.rb#3283 - def void_stmt?(left, right, allow_newline); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_sclass(*args); end - # This method is called when weak warning is produced by the parser. - # +fmt+ and +args+ is printf style. - # - # source://prism//lib/prism/translation/ripper.rb#3402 - def warn(fmt, *args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_semicolon(tok); end - # This method is called when strong warning is produced by the parser. - # +fmt+ and +args+ is printf style. - # - # source://prism//lib/prism/translation/ripper.rb#3407 - def warning(fmt, *args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_sp(tok); end - class << self - # Tokenizes the Ruby program and returns an array of an array, - # which is formatted like - # [[lineno, column], type, token, state]. - # The +filename+ argument is mostly ignored. - # By default, this method does not handle syntax errors in +src+, - # use the +raise_errors+ keyword to raise a SyntaxError for an error in +src+. - # - # require "ripper" - # require "pp" - # - # pp Ripper.lex("def m(a) nil end") - # #=> [[[1, 0], :on_kw, "def", FNAME ], - # [[1, 3], :on_sp, " ", FNAME ], - # [[1, 4], :on_ident, "m", ENDFN ], - # [[1, 5], :on_lparen, "(", BEG|LABEL], - # [[1, 6], :on_ident, "a", ARG ], - # [[1, 7], :on_rparen, ")", ENDFN ], - # [[1, 8], :on_sp, " ", BEG ], - # [[1, 9], :on_kw, "nil", END ], - # [[1, 12], :on_sp, " ", END ], - # [[1, 13], :on_kw, "end", END ]] - # - # source://prism//lib/prism/translation/ripper.rb#72 - def lex(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_stmts_add(*args); end - # Parses the given Ruby program read from +src+. - # +src+ must be a String or an IO or a object with a #gets method. - # - # source://prism//lib/prism/translation/ripper.rb#46 - def parse(src, filename = T.unsafe(nil), lineno = T.unsafe(nil)); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_stmts_new(*args); end - # Parses +src+ and create S-exp tree. - # Returns more readable tree rather than Ripper.sexp_raw. - # This method is mainly for developer use. - # The +filename+ argument is mostly ignored. - # By default, this method does not handle syntax errors in +src+, - # returning +nil+ in such cases. Use the +raise_errors+ keyword - # to raise a SyntaxError for an error in +src+. - # - # require "ripper" - # require "pp" - # - # pp Ripper.sexp("def m(a) nil end") - # #=> [:program, - # [[:def, - # [:@ident, "m", [1, 4]], - # [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil, nil, nil, nil]], - # [:bodystmt, [[:var_ref, [:@kw, "nil", [1, 9]]]], nil, nil, nil]]]] - # - # source://prism//lib/prism/translation/ripper.rb#381 - def sexp(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_add(*args); end - # Parses +src+ and create S-exp tree. - # This method is mainly for developer use. - # The +filename+ argument is mostly ignored. - # By default, this method does not handle syntax errors in +src+, - # returning +nil+ in such cases. Use the +raise_errors+ keyword - # to raise a SyntaxError for an error in +src+. - # - # require "ripper" - # require "pp" - # - # pp Ripper.sexp_raw("def m(a) nil end") - # #=> [:program, - # [:stmts_add, - # [:stmts_new], - # [:def, - # [:@ident, "m", [1, 4]], - # [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil]], - # [:bodystmt, - # [:stmts_add, [:stmts_new], [:var_ref, [:@kw, "nil", [1, 9]]]], - # nil, - # nil, - # nil]]]] - # - # source://prism//lib/prism/translation/ripper.rb#416 - def sexp_raw(src, filename = T.unsafe(nil), lineno = T.unsafe(nil), raise_errors: T.unsafe(nil)); end - end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_concat(*args); end - Result = type_member -end + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_content(*args); end -# A list of all of the Ruby binary operators. -# -# source://prism//lib/prism/translation/ripper.rb#337 -Prism::Translation::Ripper::BINARY_OPERATORS = T.let(T.unsafe(nil), Array) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_dvar(*args); end -# This array contains name of all ripper events. -# -# source://prism//lib/prism/translation/ripper.rb#289 -Prism::Translation::Ripper::EVENTS = T.let(T.unsafe(nil), Array) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_embexpr(*args); end -# A list of all of the Ruby keywords. -# -# source://prism//lib/prism/translation/ripper.rb#292 -Prism::Translation::Ripper::KEYWORDS = T.let(T.unsafe(nil), Array) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_string_literal(*args); end -# This array contains name of parser events. -# -# source://prism//lib/prism/translation/ripper.rb#283 -Prism::Translation::Ripper::PARSER_EVENTS = T.let(T.unsafe(nil), Array) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_super(*args); end -# This contains a table of all of the parser events and their -# corresponding arity. -# -# source://prism//lib/prism/translation/ripper.rb#84 -Prism::Translation::Ripper::PARSER_EVENT_TABLE = T.let(T.unsafe(nil), Hash) + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_symbeg(tok); end -# This array contains name of scanner events. -# -# source://prism//lib/prism/translation/ripper.rb#286 -Prism::Translation::Ripper::SCANNER_EVENTS = T.let(T.unsafe(nil), Array) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_symbol(*args); end -# This contains a table of all of the scanner events and their -# corresponding arity. -# -# source://prism//lib/prism/translation/ripper.rb#227 -Prism::Translation::Ripper::SCANNER_EVENT_TABLE = T.let(T.unsafe(nil), Hash) + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_symbol_literal(*args); end -# This class mirrors the ::Ripper::SexpBuilder subclass of ::Ripper that -# returns the arrays of [type, *children]. -# -# source://prism//lib/prism/translation/ripper/sexp.rb#10 -class Prism::Translation::Ripper::SexpBuilder < ::Prism::Translation::Ripper - Result = type_member { { fixed: T::Array[T.untyped] } } + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_symbols_add(*args); end - # :stopdoc: - # - # source://prism//lib/prism/translation/ripper/sexp.rb#13 - def error; end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_symbols_beg(tok); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_BEGIN(*args); end + def on_symbols_new(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_CHAR(tok); end + def on_tlambda(tok); end + + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_tlambeg(tok); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_END(*args); end + def on_top_const_field(*args); end + + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_top_const_ref(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on___end__(tok); end + def on_tstring_beg(tok); end + + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_tstring_content(tok); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_alias(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#55 + def on_tstring_end(tok); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_alias_error(*args); end + def on_unary(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_aref(*args); end + def on_undef(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_aref_field(*args); end + def on_unless(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_arg_ambiguous(*args); end + def on_unless_mod(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_arg_paren(*args); end + def on_until(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_args_add(*args); end + def on_until_mod(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_args_add_block(*args); end + def on_var_alias(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_args_add_star(*args); end + def on_var_field(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_args_forward(*args); end + def on_var_ref(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_args_new(*args); end + def on_vcall(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_array(*args); end + def on_void_stmt(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_aryptn(*args); end + def on_when(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_assign(*args); end + def on_while(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_assign_error(*args); end + def on_while_mod(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_assoc_new(*args); end + def on_word_add(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_assoc_splat(*args); end + def on_word_new(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_assoclist_from_args(*args); end + def on_words_add(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_backref(tok); end + def on_words_beg(tok); end + + # source://prism//lib/prism/translation/ripper/sexp.rb#47 + def on_words_new(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_backtick(tok); end + def on_words_sep(tok); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_bare_assoc_hash(*args); end + def on_xstring_add(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_begin(*args); end + def on_xstring_literal(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_binary(*args); end + def on_xstring_new(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_block_var(*args); end + def on_yield(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_blockarg(*args); end + def on_yield0(*args); end # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_bodystmt(*args); end + def on_zsuper(*args); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_brace_block(*args); end + private - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_break(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#61 + def compile_error(mesg); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_call(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#17 + def dedent_element(e, width); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_case(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#61 + def on_error(mesg); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_class(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#24 + def on_heredoc_dedent(val, width); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_class_name_error(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#61 + def on_parse_error(mesg); end +end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_comma(tok); end +# This class mirrors the ::Ripper::SexpBuilderPP subclass of ::Ripper that +# returns the same values as ::Ripper::SexpBuilder except with a couple of +# niceties that flatten linked lists into arrays. +# +# source://prism//lib/prism/translation/ripper/sexp.rb#74 +class Prism::Translation::Ripper::SexpBuilderPP < ::Prism::Translation::Ripper::SexpBuilder + private - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_command(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def _dispatch_event_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_command_call(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def _dispatch_event_push(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_comment(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_args_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_const(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_args_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_const_path_field(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#79 + def on_heredoc_dedent(val, width); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_const_path_ref(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_mlhs_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_const_ref(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#109 + def on_mlhs_add_post(list, post); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_cvar(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#105 + def on_mlhs_add_star(list, star); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_def(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_mlhs_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_defined(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#101 + def on_mlhs_paren(list); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_defs(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_mrhs_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_do_block(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_mrhs_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_dot2(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_qsymbols_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_dot3(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_qsymbols_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_dyna_symbol(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_qwords_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_else(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_qwords_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_elsif(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_regexp_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embdoc(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_regexp_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embdoc_beg(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_stmts_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embdoc_end(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_stmts_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embexpr_beg(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_string_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embexpr_end(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_symbols_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_embvar(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_symbols_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_ensure(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_word_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_excessed_comma(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_word_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_fcall(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_words_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_field(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_words_new; end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_float(tok); end + # source://prism//lib/prism/translation/ripper/sexp.rb#96 + def on_xstring_add(list, item); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_fndptn(*args); end + # source://prism//lib/prism/translation/ripper/sexp.rb#92 + def on_xstring_new; end +end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_for(*args); end +# This module is the entry-point for converting a prism syntax tree into the +# seattlerb/ruby_parser gem's syntax tree. +# +# source://prism//lib/prism/translation/ruby_parser.rb#14 +class Prism::Translation::RubyParser + # Parse the given source and translate it into the seattlerb/ruby_parser + # gem's Sexp format. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1608 + def parse(source, filepath = T.unsafe(nil)); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_gvar(tok); end + # Parse the given file and translate it into the seattlerb/ruby_parser + # gem's Sexp format. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1614 + def parse_file(filepath); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_hash(*args); end + private - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_heredoc_beg(tok); end + # Translate the given parse result and filepath into the + # seattlerb/ruby_parser gem's Sexp format. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1636 + def translate(result, filepath); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_heredoc_end(tok); end + class << self + # Parse the given source and translate it into the seattlerb/ruby_parser + # gem's Sexp format. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1621 + def parse(source, filepath = T.unsafe(nil)); end + + # Parse the given file and translate it into the seattlerb/ruby_parser + # gem's Sexp format. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1627 + def parse_file(filepath); end + end +end + +# A prism visitor that builds Sexp objects. +# +# source://prism//lib/prism/translation/ruby_parser.rb#16 +class Prism::Translation::RubyParser::Compiler < ::Prism::Compiler + # Initialize a new compiler with the given file name. + # + # @return [Compiler] a new instance of Compiler + # + # source://prism//lib/prism/translation/ruby_parser.rb#31 + def initialize(file, in_def: T.unsafe(nil), in_pattern: T.unsafe(nil)); end + + # This is the name of the file that we are compiling. We set it on every + # Sexp object that is generated, and also use it to compile __FILE__ + # nodes. + # + # source://prism//lib/prism/translation/ruby_parser.rb#20 + def file; end + + # Class variables will change their type based on if they are inside of + # a method definition or not, so we need to track that state. + # + # source://prism//lib/prism/translation/ruby_parser.rb#24 + def in_def; end + + # Some nodes will change their representation if they are inside of a + # pattern, so we need to track that state. + # + # source://prism//lib/prism/translation/ruby_parser.rb#28 + def in_pattern; end + + # alias $foo $bar + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#45 + def visit_alias_global_variable_node(node); end + + # alias foo bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#39 + def visit_alias_method_node(node); end + + # foo => bar | baz + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#51 + def visit_alternation_pattern_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_hshptn(*args); end + # a and b + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#57 + def visit_and_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_ident(tok); end + # foo(bar) + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#108 + def visit_arguments_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_if(*args); end + # [] + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#75 + def visit_array_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_if_mod(*args); end + # foo => [bar] + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#85 + def visit_array_pattern_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_ifop(*args); end + # { a: 1 } + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#114 + def visit_assoc_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_ignored_nl(tok); end + # def foo(**); bar(**); end + # ^^ + # + # { **foo } + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#123 + def visit_assoc_splat_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_ignored_sp(tok); end + # $+ + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#133 + def visit_back_reference_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_imaginary(tok); end + # begin end + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#139 + def visit_begin_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_in(*args); end + # foo(&bar) + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#172 + def visit_block_argument_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_int(tok); end + # foo { |; bar| } + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#180 + def visit_block_local_variable_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_ivar(tok); end + # A block on a keyword or method call. + # + # source://prism//lib/prism/translation/ruby_parser.rb#185 + def visit_block_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_kw(tok); end + # def foo(&bar); end + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#191 + def visit_block_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_kwrest_param(*args); end + # A block's parameters. + # + # source://prism//lib/prism/translation/ruby_parser.rb#196 + def visit_block_parameters_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_label(tok); end + # break + # ^^^^^ + # + # break foo + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#236 + def visit_break_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_label_end(tok); end + # foo.bar &&= baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#304 + def visit_call_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_lambda(*args); end + # foo + # ^^^ + # + # foo.bar + # ^^^^^^^ + # + # foo.bar() {} + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#254 + def visit_call_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_lbrace(tok); end + # foo.bar += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#294 + def visit_call_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_lbracket(tok); end + # foo.bar ||= baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#314 + def visit_call_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_lparen(tok); end + # foo.bar, = 1 + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#337 + def visit_call_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_magic_comment(*args); end + # foo => bar => baz + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#343 + def visit_capture_pattern_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_massign(*args); end + # case foo; in bar; end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#355 + def visit_case_match_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_method_add_arg(*args); end + # case foo; when bar; end + # ^^^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#349 + def visit_case_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_method_add_block(*args); end + # class Foo; end + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#361 + def visit_class_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mlhs_add(*args); end + # @@foo &&= bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#402 + def visit_class_variable_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mlhs_add_post(*args); end + # @@foo += bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#396 + def visit_class_variable_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mlhs_add_star(*args); end + # @@foo ||= bar + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#408 + def visit_class_variable_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mlhs_new(*args); end + # @@foo + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#381 + def visit_class_variable_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mlhs_paren(*args); end + # @@foo, = bar + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#414 + def visit_class_variable_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_module(*args); end + # @@foo = 1 + # ^^^^^^^^^ + # + # @@foo, @@bar = 1 + # ^^^^^ ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#390 + def visit_class_variable_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mrhs_add(*args); end + # Foo &&= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#447 + def visit_constant_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mrhs_add_star(*args); end + # Foo += bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#441 + def visit_constant_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mrhs_new(*args); end + # Foo ||= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#453 + def visit_constant_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_mrhs_new_from_args(*args); end + # Foo::Bar &&= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#490 + def visit_constant_path_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_next(*args); end + # Foo::Bar + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#465 + def visit_constant_path_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_nl(tok); end + # Foo::Bar += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#484 + def visit_constant_path_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_nokw_param(*args); end + # Foo::Bar ||= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#496 + def visit_constant_path_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_op(tok); end + # Foo::Bar, = baz + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#502 + def visit_constant_path_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_opassign(*args); end + # Foo::Bar = 1 + # ^^^^^^^^^^^^ + # + # Foo::Foo, Bar::Bar = 1 + # ^^^^^^^^ ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#478 + def visit_constant_path_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_operator_ambiguous(*args); end + # Foo + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#426 + def visit_constant_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_param_error(*args); end + # Foo, = bar + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#459 + def visit_constant_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_params(*args); end + # Foo = 1 + # ^^^^^^^ + # + # Foo, Bar = 1 + # ^^^ ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#435 + def visit_constant_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_paren(*args); end + # def foo; end + # ^^^^^^^^^^^^ + # + # def self.foo; end + # ^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#518 + def visit_def_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_period(tok); end + # defined? a + # ^^^^^^^^^^ + # + # defined?(a) + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#549 + def visit_defined_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_program(*args); end + # if foo then bar else baz end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#555 + def visit_else_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_qsymbols_add(*args); end + # "foo #{bar}" + # ^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#561 + def visit_embedded_statements_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_qsymbols_beg(tok); end + # "foo #@bar" + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#569 + def visit_embedded_variable_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_qsymbols_new(*args); end + # begin; foo; ensure; bar; end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#575 + def visit_ensure_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_qwords_add(*args); end + # false + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#581 + def visit_false_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_qwords_beg(tok); end + # foo => [*, bar, *] + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#587 + def visit_find_pattern_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_qwords_new(*args); end + # if foo .. bar; end + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#593 + def visit_flip_flop_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_rational(tok); end + # 1.0 + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#603 + def visit_float_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_rbrace(tok); end + # for foo in bar do end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#609 + def visit_for_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_rbracket(tok); end + # def foo(...); bar(...); end + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#615 + def visit_forwarding_arguments_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_redo(*args); end + # def foo(...); end + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#621 + def visit_forwarding_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_regexp_add(*args); end + # super + # ^^^^^ + # + # super {} + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#630 + def visit_forwarding_super_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_regexp_beg(tok); end + # $foo &&= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#657 + def visit_global_variable_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_regexp_end(tok); end + # $foo += bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#651 + def visit_global_variable_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_regexp_literal(*args); end + # $foo ||= bar + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#663 + def visit_global_variable_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_regexp_new(*args); end + # $foo + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#636 + def visit_global_variable_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_rescue(*args); end + # $foo, = bar + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#669 + def visit_global_variable_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_rescue_mod(*args); end + # $foo = 1 + # ^^^^^^^^ + # + # $foo, $bar = 1 + # ^^^^ ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#645 + def visit_global_variable_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_rest_param(*args); end + # {} + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#675 + def visit_hash_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_retry(*args); end + # foo => {} + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#681 + def visit_hash_pattern_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_return(*args); end + # if foo then bar end + # ^^^^^^^^^^^^^^^^^^^ + # + # bar if foo + # ^^^^^^^^^^ + # + # foo ? bar : baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#702 + def visit_if_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_return0(*args); end + # 1i + # + # source://prism//lib/prism/translation/ruby_parser.rb#707 + def visit_imaginary_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_rparen(tok); end + # { foo: } + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#713 + def visit_implicit_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_sclass(*args); end + # foo { |bar,| } + # ^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#718 + def visit_implicit_rest_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_semicolon(tok); end + # case foo; in bar; end + # ^^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#723 + def visit_in_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_sp(tok); end + # foo[bar] &&= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#749 + def visit_index_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_stmts_add(*args); end + # foo[bar] += baz + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#736 + def visit_index_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_stmts_new(*args); end + # foo[bar] ||= baz + # ^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#762 + def visit_index_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_add(*args); end + # foo[bar], = 1 + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#775 + def visit_index_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_concat(*args); end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#805 + def visit_instance_variable_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_content(*args); end + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#799 + def visit_instance_variable_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_dvar(*args); end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#811 + def visit_instance_variable_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_embexpr(*args); end + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#784 + def visit_instance_variable_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_string_literal(*args); end + # @foo, = bar + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#817 + def visit_instance_variable_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_super(*args); end + # ^^^^^^^^ + # + # @foo, @bar = 1 + # ^^^^ ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#793 + def visit_instance_variable_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_symbeg(tok); end + # 1 + # ^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#823 + def visit_integer_node(node); end + + # if /foo #{bar}/ then end + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#829 + def visit_interpolated_match_last_line_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_symbol(*args); end + # /foo #{bar}/ + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#846 + def visit_interpolated_regular_expression_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_symbol_literal(*args); end + # "foo #{bar}" + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#861 + def visit_interpolated_string_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_symbols_add(*args); end + # :"foo #{bar}" + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#868 + def visit_interpolated_symbol_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_symbols_beg(tok); end + # `foo #{bar}` + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#875 + def visit_interpolated_x_string_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_symbols_new(*args); end + # -> { it } + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#956 + def visit_it_local_variable_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_tlambda(tok); end + # foo(bar: baz) + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#962 + def visit_keyword_hash_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_tlambeg(tok); end + # def foo(**bar); end + # ^^^^^ + # + # def foo(**); end + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#971 + def visit_keyword_rest_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_top_const_field(*args); end + # -> {} + # + # source://prism//lib/prism/translation/ruby_parser.rb#976 + def visit_lambda_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_top_const_ref(*args); end + # foo &&= bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1019 + def visit_local_variable_and_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_tstring_beg(tok); end + # foo += bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1013 + def visit_local_variable_operator_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_tstring_content(tok); end + # foo ||= bar + # ^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1025 + def visit_local_variable_or_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_tstring_end(tok); end + # foo + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#994 + def visit_local_variable_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_unary(*args); end + # foo, = bar + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1031 + def visit_local_variable_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_undef(*args); end + # foo = 1 + # ^^^^^^^ + # + # foo, bar = 1 + # ^^^ ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1007 + def visit_local_variable_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_unless(*args); end + # if /foo/ then end + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1037 + def visit_match_last_line_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_unless_mod(*args); end + # foo in bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1043 + def visit_match_predicate_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_until(*args); end + # foo => bar + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1049 + def visit_match_required_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_until_mod(*args); end + # /(?foo)/ =~ bar + # ^^^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1055 + def visit_match_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_var_alias(*args); end + # A node that is missing from the syntax tree. This is only used in the + # case of a syntax error. The parser gem doesn't have such a concept, so + # we invent our own here. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1062 + def visit_missing_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_var_field(*args); end + # module Foo; end + # ^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1068 + def visit_module_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_var_ref(*args); end + # foo, bar = baz + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1088 + def visit_multi_target_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_vcall(*args); end + # foo, bar = baz + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1098 + def visit_multi_write_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_void_stmt(*args); end + # next + # ^^^^ + # + # next foo + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1122 + def visit_next_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_when(*args); end + # nil + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1135 + def visit_nil_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_while(*args); end + # def foo(**nil); end + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1141 + def visit_no_keywords_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_while_mod(*args); end + # -> { _1 + _2 } + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1147 + def visit_numbered_parameters_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_word_add(*args); end + # $1 + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1153 + def visit_numbered_reference_read_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_word_new(*args); end + # def foo(bar: baz); end + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1159 + def visit_optional_keyword_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_words_add(*args); end + # def foo(bar = 1); end + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1165 + def visit_optional_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_words_beg(tok); end + # a or b + # ^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1171 + def visit_or_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_words_new(*args); end + # def foo(bar, *baz); end + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1189 + def visit_parameters_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#55 - def on_words_sep(tok); end + # () + # ^^ + # + # (1) + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1227 + def visit_parentheses_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_xstring_add(*args); end + # foo => ^(bar) + # ^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1237 + def visit_pinned_expression_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_xstring_literal(*args); end + # foo = 1 and bar => ^foo + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1243 + def visit_pinned_variable_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_xstring_new(*args); end + # END {} + # + # source://prism//lib/prism/translation/ruby_parser.rb#1252 + def visit_post_execution_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_yield(*args); end + # BEGIN {} + # + # source://prism//lib/prism/translation/ruby_parser.rb#1257 + def visit_pre_execution_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_yield0(*args); end + # The top-level program node. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1262 + def visit_program_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#47 - def on_zsuper(*args); end + # 0..5 + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1268 + def visit_range_node(node); end - private + # 1r + # ^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1290 + def visit_rational_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#61 - def compile_error(mesg); end + # redo + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1296 + def visit_redo_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#17 - def dedent_element(e, width); end + # /foo/ + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1302 + def visit_regular_expression_node(node); end + + # def foo(bar:); end + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1308 + def visit_required_keyword_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#61 - def on_error(mesg); end + # def foo(bar); end + # ^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1314 + def visit_required_parameter_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#24 - def on_heredoc_dedent(val, width); end + # foo rescue bar + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1320 + def visit_rescue_modifier_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#61 - def on_parse_error(mesg); end -end + # begin; rescue; end + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1326 + def visit_rescue_node(node); end -# This class mirrors the ::Ripper::SexpBuilderPP subclass of ::Ripper that -# returns the same values as ::Ripper::SexpBuilder except with a couple of -# niceties that flatten linked lists into arrays. -# -# source://prism//lib/prism/translation/ripper/sexp.rb#74 -class Prism::Translation::Ripper::SexpBuilderPP < ::Prism::Translation::Ripper::SexpBuilder - Result = type_member { { fixed: T::Array[T.untyped] } } + # def foo(*bar); end + # ^^^^ + # + # def foo(*); end + # ^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1346 + def visit_rest_parameter_node(node); end - private + # retry + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1352 + def visit_retry_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def _dispatch_event_new; end + # return + # ^^^^^^ + # + # return 1 + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1361 + def visit_return_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def _dispatch_event_push(list, item); end + # self + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1374 + def visit_self_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_args_add(list, item); end + # A shareable constant. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1379 + def visit_shareable_constant_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_args_new; end + # class << self; end + # ^^^^^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1385 + def visit_singleton_class_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#79 - def on_heredoc_dedent(val, width); end + # __ENCODING__ + # ^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1393 + def visit_source_encoding_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_mlhs_add(list, item); end + # __FILE__ + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1400 + def visit_source_file_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#109 - def on_mlhs_add_post(list, post); end + # __LINE__ + # ^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1406 + def visit_source_line_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#105 - def on_mlhs_add_star(list, star); end + # foo(*bar) + # ^^^^ + # + # def foo((bar, *baz)); end + # ^^^^ + # + # def foo(*); bar(*); end + # ^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1418 + def visit_splat_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_mlhs_new; end + # A list of statements. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1427 + def visit_statements_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#101 - def on_mlhs_paren(list); end + # "foo" + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1439 + def visit_string_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_mrhs_add(list, item); end + # super(foo) + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1452 + def visit_super_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_mrhs_new; end + # :foo + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1466 + def visit_symbol_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_qsymbols_add(list, item); end + # true + # ^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1472 + def visit_true_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_qsymbols_new; end + # undef foo + # ^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1478 + def visit_undef_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_qwords_add(list, item); end + # unless foo; bar end + # ^^^^^^^^^^^^^^^^^^^ + # + # bar unless foo + # ^^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1488 + def visit_unless_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_qwords_new; end + # until foo; bar end + # ^^^^^^^^^^^^^^^^^ + # + # bar until foo + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1497 + def visit_until_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_regexp_add(list, item); end + # case foo; when bar; end + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1503 + def visit_when_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_regexp_new; end + # while foo; bar end + # ^^^^^^^^^^^^^^^^^^ + # + # bar while foo + # ^^^^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1512 + def visit_while_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_stmts_add(list, item); end + # `foo` + # ^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1518 + def visit_x_string_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_stmts_new; end + # yield + # ^^^^^ + # + # yield 1 + # ^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1534 + def visit_yield_node(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_string_add(list, item); end + private - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_symbols_add(list, item); end + # If a class variable is written within a method definition, it has a + # different type than everywhere else. + # + # source://prism//lib/prism/translation/ruby_parser.rb#420 + def class_variable_write_type; end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_symbols_new; end + # Create a new compiler with the given options. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1541 + def copy_compiler(in_def: T.unsafe(nil), in_pattern: T.unsafe(nil)); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_word_add(list, item); end + # Call nodes with operators following them will either be op_asgn or + # op_asgn2 nodes. That is determined by their call operator and their + # right-hand side. + # + # @return [Boolean] + # + # source://prism//lib/prism/translation/ruby_parser.rb#325 + def op_asgn?(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_word_new; end + # Call nodes with operators following them can use &. as an operator, + # which changes their type by prefixing "safe_". + # + # source://prism//lib/prism/translation/ruby_parser.rb#331 + def op_asgn_type(node, type); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_words_add(list, item); end + # Create a new Sexp object from the given prism node and arguments. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1546 + def s(node, *arguments); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_words_new; end + # Visit a block node, which will modify the AST by wrapping the given + # visited node in an iter node. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1556 + def visit_block(node, sexp, block); end - # source://prism//lib/prism/translation/ripper/sexp.rb#96 - def on_xstring_add(list, item); end + # def foo((bar, baz)); end + # ^^^^^^^^^^ + # + # source://prism//lib/prism/translation/ruby_parser.rb#1204 + def visit_destructured_parameter(node); end - # source://prism//lib/prism/translation/ripper/sexp.rb#92 - def on_xstring_new; end -end + # Visit the interpolated content of the string-like node. + # + # source://prism//lib/prism/translation/ruby_parser.rb#882 + def visit_interpolated_parts(parts); end -class Prism::Translation::RipperCompiler < Prism::Compiler - Result = type_member -end + # Pattern constants get wrapped in another layer of :const. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1577 + def visit_pattern_constant(node); end -class Prism::Translation::RubyParser::Compiler < Prism::Compiler - Result = type_member { { fixed: Sexp } } + # If the bounds of a range node are empty parentheses, then they do not + # get replaced by their usual s(:nil), but instead are s(:begin). + # + # source://prism//lib/prism/translation/ruby_parser.rb#1280 + def visit_range_bounds_node(node); end + + # Visit the value of a write, which will be on the right-hand side of + # a write operator. Because implicit arrays can have splats, those could + # potentially be wrapped in an svalue node. + # + # source://prism//lib/prism/translation/ruby_parser.rb#1591 + def visit_write_value(node); end end # Represents the use of the literal `true` keyword. @@ -34716,102 +39467,84 @@ end # true # ^^^^ # -# source://prism//lib/prism/node.rb#19158 +# source://prism//lib/prism/node.rb#17368 class Prism::TrueNode < ::Prism::Node - # def initialize: (Location location) -> void + # Initialize a new TrueNode node. # # @return [TrueNode] a new instance of TrueNode # - # source://prism//lib/prism/node.rb#19160 - sig { params(source: Prism::Source, location: Prism::Location).void } - def initialize(source, location); end + # source://prism//lib/prism/node.rb#17370 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } + def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19235 + # source://prism//lib/prism/node.rb#17427 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19167 + # source://prism//lib/prism/node.rb#17378 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19172 + # source://prism//lib/prism/node.rb#17383 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19182 + # source://prism//lib/prism/node.rb#17393 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19177 + # source://prism//lib/prism/node.rb#17388 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?location: Location) -> TrueNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode # - # source://prism//lib/prism/node.rb#19187 - sig { params(location: Prism::Location).returns(Prism::TrueNode) } - def copy(location: T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17398 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::TrueNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19172 + # source://prism//lib/prism/node.rb#17383 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # - # source://prism//lib/prism/node.rb#19195 + # source://prism//lib/prism/node.rb#17406 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19200 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17411 + sig { override.returns(String) } + def inspect; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#19219 + # source://prism//lib/prism/node.rb#17416 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19229 + # source://prism//lib/prism/node.rb#17421 def type; end end end @@ -34821,133 +39554,125 @@ end # undef :foo, :bar, :baz # ^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#19244 +# source://prism//lib/prism/node.rb#17436 class Prism::UndefNode < ::Prism::Node - # def initialize: (Array[SymbolNode | InterpolatedSymbolNode] names, Location keyword_loc, Location location) -> void + # Initialize a new UndefNode node. # # @return [UndefNode] a new instance of UndefNode # - # source://prism//lib/prism/node.rb#19246 + # source://prism//lib/prism/node.rb#17438 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, names: T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)], - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).void end - def initialize(source, names, keyword_loc, location); end + def initialize(source, node_id, location, flags, names, keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19340 + # source://prism//lib/prism/node.rb#17518 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19255 + # source://prism//lib/prism/node.rb#17448 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19260 + # source://prism//lib/prism/node.rb#17453 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19270 + # source://prism//lib/prism/node.rb#17463 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19265 + # source://prism//lib/prism/node.rb#17458 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location, ?location: Location) -> UndefNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode # - # source://prism//lib/prism/node.rb#19275 + # source://prism//lib/prism/node.rb#17468 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, names: T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)], - keyword_loc: Prism::Location, - location: Prism::Location + keyword_loc: Prism::Location ).returns(Prism::UndefNode) end - def copy(names: T.unsafe(nil), keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), names: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19260 + # source://prism//lib/prism/node.rb#17453 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { names: Array[SymbolNode | InterpolatedSymbolNode], keyword_loc: Location, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, names: Array[SymbolNode | InterpolatedSymbolNode], keyword_loc: Location } # - # source://prism//lib/prism/node.rb#19283 + # source://prism//lib/prism/node.rb#17476 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19303 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17502 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#19298 + # source://prism//lib/prism/node.rb#17497 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#19291 + # source://prism//lib/prism/node.rb#17484 sig { returns(Prism::Location) } def keyword_loc; end - - # attr_reader names: Array[SymbolNode | InterpolatedSymbolNode] - # - # source://prism//lib/prism/node.rb#19288 - sig { returns(T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)]) } - def names; end - - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + + # attr_reader names: Array[SymbolNode | InterpolatedSymbolNode] + # + # source://prism//lib/prism/node.rb#17481 + sig { returns(T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)]) } + def names; end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#17492 + def save_keyword_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#19324 + # source://prism//lib/prism/node.rb#17507 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#19334 + # source://prism//lib/prism/node.rb#17512 def type; end end end @@ -34960,98 +39685,108 @@ end # unless foo then bar end # ^^^^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#19355 +# source://prism//lib/prism/node.rb#17533 class Prism::UnlessNode < ::Prism::Node - # def initialize: (Location keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, ElseNode? consequent, Location? end_keyword_loc, Location location) -> void + # Initialize a new UnlessNode node. # # @return [UnlessNode] a new instance of UnlessNode # - # source://prism//lib/prism/node.rb#19357 + # source://prism//lib/prism/node.rb#17535 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, predicate: Prism::Node, then_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::ElseNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + else_clause: T.nilable(Prism::ElseNode), + end_keyword_loc: T.nilable(Prism::Location) ).void end - def initialize(source, keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location); end + def initialize(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19543 + # source://prism//lib/prism/node.rb#17702 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19370 + # source://prism//lib/prism/node.rb#17549 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19379 + # source://prism//lib/prism/node.rb#17554 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19393 + # source://prism//lib/prism/node.rb#17568 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19384 + # source://prism//lib/prism/node.rb#17559 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # The else clause of the unless expression, if present. + # Returns the else clause of the unless node. This method is deprecated in + # favor of #else_clause. # - # unless cond then bar else baz end - # ^^^^^^^^ - # - # source://prism//lib/prism/node.rb#19457 - sig { returns(T.nilable(Prism::ElseNode)) } + # source://prism//lib/prism/node_ext.rb#503 def consequent; end - # def copy: (?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?consequent: ElseNode?, ?end_keyword_loc: Location?, ?location: Location) -> UnlessNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode # - # source://prism//lib/prism/node.rb#19398 + # source://prism//lib/prism/node.rb#17573 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, predicate: Prism::Node, then_keyword_loc: T.nilable(Prism::Location), statements: T.nilable(Prism::StatementsNode), - consequent: T.nilable(Prism::ElseNode), - end_keyword_loc: T.nilable(Prism::Location), - location: Prism::Location + else_clause: T.nilable(Prism::ElseNode), + end_keyword_loc: T.nilable(Prism::Location) ).returns(Prism::UnlessNode) end - def copy(keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), consequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), else_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19379 + # source://prism//lib/prism/node.rb#17554 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: ElseNode?, end_keyword_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, else_clause: ElseNode?, end_keyword_loc: Location? } # - # source://prism//lib/prism/node.rb#19406 + # source://prism//lib/prism/node.rb#17581 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # The else clause of the unless expression, if present. + # + # unless cond then bar else baz end + # ^^^^^^^^ + # + # source://prism//lib/prism/node.rb#17646 + sig { returns(T.nilable(Prism::ElseNode)) } + def else_clause; end + # def end_keyword: () -> String? # - # source://prism//lib/prism/node.rb#19486 + # source://prism//lib/prism/node.rb#17681 sig { returns(T.nilable(String)) } def end_keyword; end @@ -35060,22 +39795,22 @@ class Prism::UnlessNode < ::Prism::Node # unless cond then bar end # ^^^ # - # source://prism//lib/prism/node.rb#19463 + # source://prism//lib/prism/node.rb#17652 sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19491 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17686 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#19476 + # source://prism//lib/prism/node.rb#17671 sig { returns(String) } def keyword; end @@ -35087,10 +39822,13 @@ class Prism::UnlessNode < ::Prism::Node # bar unless cond # ^^^^^^ # - # source://prism//lib/prism/node.rb#19417 + # source://prism//lib/prism/node.rb#17592 sig { returns(Prism::Location) } def keyword_loc; end + # source://prism//lib/prism/parse_result/newlines.rb#97 + def newline_flag!(lines); end + # The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). # # unless cond then bar end @@ -35099,12 +39837,27 @@ class Prism::UnlessNode < ::Prism::Node # bar unless cond # ^^^^ # - # source://prism//lib/prism/node.rb#19430 + # source://prism//lib/prism/node.rb#17611 sig { returns(Prism::Node) } def predicate; end - # source://prism//lib/prism/node.rb#19374 - def set_newline_flag(newline_marked); end + # Save the end_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17666 + def save_end_keyword_loc(repository); end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17600 + def save_keyword_loc(repository); end + + # Save the then_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17631 + def save_then_keyword_loc(repository); end # The body of statements that will executed if the unless condition is # falsey. Will be `nil` if no body is provided. @@ -35112,51 +39865,35 @@ class Prism::UnlessNode < ::Prism::Node # unless cond then bar end # ^^^ # - # source://prism//lib/prism/node.rb#19451 + # source://prism//lib/prism/node.rb#17640 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then_keyword: () -> String? # - # source://prism//lib/prism/node.rb#19481 + # source://prism//lib/prism/node.rb#17676 sig { returns(T.nilable(String)) } def then_keyword; end # The location of the `then` keyword, if present. - # unless cond then bar end ^^^^ # - # source://prism//lib/prism/node.rb#19434 + # unless cond then bar end + # ^^^^ + # + # source://prism//lib/prism/node.rb#17617 sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19527 + # source://prism//lib/prism/node.rb#17691 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#19537 + # source://prism//lib/prism/node.rb#17696 def type; end end end @@ -35169,35 +39906,37 @@ end # until foo do bar end # ^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#19561 +# source://prism//lib/prism/node.rb#17720 class Prism::UntilNode < ::Prism::Node - # def initialize: (Integer flags, Location keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements, Location location) -> void + # Initialize a new UntilNode node. # # @return [UntilNode] a new instance of UntilNode # - # source://prism//lib/prism/node.rb#19563 + # source://prism//lib/prism/node.rb#17722 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), closing_loc: T.nilable(Prism::Location), predicate: Prism::Node, - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).void end - def initialize(source, flags, keyword_loc, closing_loc, predicate, statements, location); end + def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19707 + # source://prism//lib/prism/node.rb#17864 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19575 + # source://prism//lib/prism/node.rb#17735 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -35205,140 +39944,146 @@ class Prism::UntilNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#19645 + # source://prism//lib/prism/node.rb#17771 sig { returns(T::Boolean) } def begin_modifier?; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19584 + # source://prism//lib/prism/node.rb#17740 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#19655 + # source://prism//lib/prism/node.rb#17843 sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # - # source://prism//lib/prism/node.rb#19626 + # source://prism//lib/prism/node.rb#17808 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19597 + # source://prism//lib/prism/node.rb#17753 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19589 + # source://prism//lib/prism/node.rb#17745 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?keyword_loc: Location, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?, ?location: Location) -> UntilNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode # - # source://prism//lib/prism/node.rb#19602 + # source://prism//lib/prism/node.rb#17758 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), closing_loc: T.nilable(Prism::Location), predicate: Prism::Node, - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).returns(Prism::UntilNode) end - def copy(flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19584 + # source://prism//lib/prism/node.rb#17740 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, keyword_loc: Location, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, do_keyword_loc: Location?, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? } # - # source://prism//lib/prism/node.rb#19610 + # source://prism//lib/prism/node.rb#17766 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # def do_keyword: () -> String? + # + # source://prism//lib/prism/node.rb#17838 + sig { returns(T.nilable(String)) } + def do_keyword; end + + # attr_reader do_keyword_loc: Location? + # + # source://prism//lib/prism/node.rb#17789 + sig { returns(T.nilable(Prism::Location)) } + def do_keyword_loc; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19660 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17848 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#19650 + # source://prism//lib/prism/node.rb#17833 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#19619 + # source://prism//lib/prism/node.rb#17776 sig { returns(Prism::Location) } def keyword_loc; end + # source://prism//lib/prism/parse_result/newlines.rb#103 + def newline_flag!(lines); end + # attr_reader predicate: Prism::node # - # source://prism//lib/prism/node.rb#19639 + # source://prism//lib/prism/node.rb#17827 sig { returns(Prism::Node) } def predicate; end - # source://prism//lib/prism/node.rb#19579 - def set_newline_flag(newline_marked); end + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17822 + def save_closing_loc(repository); end + + # Save the do_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17803 + def save_do_keyword_loc(repository); end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17784 + def save_keyword_loc(repository); end # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#19642 + # source://prism//lib/prism/node.rb#17830 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # Return a symbol representation of this node type. See `Node#type`. # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19691 + # source://prism//lib/prism/node.rb#17853 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#19615 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#19701 + # source://prism//lib/prism/node.rb#17858 def type; end end end @@ -35889,6 +40634,12 @@ class Prism::Visitor < ::Prism::BasicVisitor sig { params(node: Prism::InterpolatedXStringNode).void } def visit_interpolated_x_string_node(node); end + # Visit a ItLocalVariableReadNode node + # + # source://prism//lib/prism/visitor.rb#29 + sig { params(node: Prism::ItLocalVariableReadNode).void } + def visit_it_local_variable_read_node(node); end + # Visit a ItParametersNode node # # source://prism//lib/prism/visitor.rb#29 @@ -36275,155 +41026,153 @@ end # ^^^^^^^^^ # end # -# source://prism//lib/prism/node.rb#19723 +# source://prism//lib/prism/node.rb#17881 class Prism::WhenNode < ::Prism::Node - # def initialize: (Location keyword_loc, Array[Prism::node] conditions, Location? then_keyword_loc, StatementsNode? statements, Location location) -> void + # Initialize a new WhenNode node. # # @return [WhenNode] a new instance of WhenNode # - # source://prism//lib/prism/node.rb#19725 + # source://prism//lib/prism/node.rb#17883 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, conditions: T::Array[Prism::Node], then_keyword_loc: T.nilable(Prism::Location), - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).void end - def initialize(source, keyword_loc, conditions, then_keyword_loc, statements, location); end + def initialize(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#19852 + # source://prism//lib/prism/node.rb#17995 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19736 + # source://prism//lib/prism/node.rb#17895 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19741 + # source://prism//lib/prism/node.rb#17900 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19754 + # source://prism//lib/prism/node.rb#17913 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19746 + # source://prism//lib/prism/node.rb#17905 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader conditions: Array[Prism::node] # - # source://prism//lib/prism/node.rb#19779 + # source://prism//lib/prism/node.rb#17944 sig { returns(T::Array[Prism::Node]) } def conditions; end - # def copy: (?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?location: Location) -> WhenNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode # - # source://prism//lib/prism/node.rb#19759 + # source://prism//lib/prism/node.rb#17918 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, conditions: T::Array[Prism::Node], then_keyword_loc: T.nilable(Prism::Location), - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).returns(Prism::WhenNode) end - def copy(keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19741 + # source://prism//lib/prism/node.rb#17900 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, conditions: Array[Prism::node], then_keyword_loc: Location?, statements: StatementsNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, conditions: Array[Prism::node], then_keyword_loc: Location?, statements: StatementsNode? } # - # source://prism//lib/prism/node.rb#19767 + # source://prism//lib/prism/node.rb#17926 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19808 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#17979 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#19798 + # source://prism//lib/prism/node.rb#17969 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#19772 + # source://prism//lib/prism/node.rb#17931 sig { returns(Prism::Location) } def keyword_loc; end + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17939 + def save_keyword_loc(repository); end + + # Save the then_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#17961 + def save_then_keyword_loc(repository); end + # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#19795 + # source://prism//lib/prism/node.rb#17966 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then_keyword: () -> String? # - # source://prism//lib/prism/node.rb#19803 + # source://prism//lib/prism/node.rb#17974 sig { returns(T.nilable(String)) } def then_keyword; end # attr_reader then_keyword_loc: Location? # - # source://prism//lib/prism/node.rb#19782 + # source://prism//lib/prism/node.rb#17947 sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#19836 + # source://prism//lib/prism/node.rb#17984 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19846 + # source://prism//lib/prism/node.rb#17989 def type; end end end @@ -36436,35 +41185,37 @@ end # while foo do bar end # ^^^^^^^^^^^^^^^^^^^^ # -# source://prism//lib/prism/node.rb#19869 +# source://prism//lib/prism/node.rb#18012 class Prism::WhileNode < ::Prism::Node - # def initialize: (Integer flags, Location keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements, Location location) -> void + # Initialize a new WhileNode node. # # @return [WhileNode] a new instance of WhileNode # - # source://prism//lib/prism/node.rb#19871 + # source://prism//lib/prism/node.rb#18014 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), closing_loc: T.nilable(Prism::Location), predicate: Prism::Node, - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).void end - def initialize(source, flags, keyword_loc, closing_loc, predicate, statements, location); end + def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#20015 + # source://prism//lib/prism/node.rb#18156 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#19883 + # source://prism//lib/prism/node.rb#18027 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end @@ -36472,140 +41223,146 @@ class Prism::WhileNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#19953 + # source://prism//lib/prism/node.rb#18063 sig { returns(T::Boolean) } def begin_modifier?; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19892 + # source://prism//lib/prism/node.rb#18032 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # - # source://prism//lib/prism/node.rb#19963 + # source://prism//lib/prism/node.rb#18135 sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # - # source://prism//lib/prism/node.rb#19934 + # source://prism//lib/prism/node.rb#18100 sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#19905 + # source://prism//lib/prism/node.rb#18045 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#19897 + # source://prism//lib/prism/node.rb#18037 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?flags: Integer, ?keyword_loc: Location, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?, ?location: Location) -> WhileNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode # - # source://prism//lib/prism/node.rb#19910 + # source://prism//lib/prism/node.rb#18050 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), closing_loc: T.nilable(Prism::Location), predicate: Prism::Node, - statements: T.nilable(Prism::StatementsNode), - location: Prism::Location + statements: T.nilable(Prism::StatementsNode) ).returns(Prism::WhileNode) end - def copy(flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#19892 + # source://prism//lib/prism/node.rb#18032 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, keyword_loc: Location, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, do_keyword_loc: Location?, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? } # - # source://prism//lib/prism/node.rb#19918 + # source://prism//lib/prism/node.rb#18058 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end + # def do_keyword: () -> String? + # + # source://prism//lib/prism/node.rb#18130 + sig { returns(T.nilable(String)) } + def do_keyword; end + + # attr_reader do_keyword_loc: Location? + # + # source://prism//lib/prism/node.rb#18081 + sig { returns(T.nilable(Prism::Location)) } + def do_keyword_loc; end + sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#19968 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#18140 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#19958 + # source://prism//lib/prism/node.rb#18125 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#19927 + # source://prism//lib/prism/node.rb#18068 sig { returns(Prism::Location) } def keyword_loc; end + # source://prism//lib/prism/parse_result/newlines.rb#109 + def newline_flag!(lines); end + # attr_reader predicate: Prism::node # - # source://prism//lib/prism/node.rb#19947 + # source://prism//lib/prism/node.rb#18119 sig { returns(Prism::Node) } def predicate; end - # source://prism//lib/prism/node.rb#19887 - def set_newline_flag(newline_marked); end + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18114 + def save_closing_loc(repository); end + + # Save the do_keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18095 + def save_do_keyword_loc(repository); end + + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18076 + def save_keyword_loc(repository); end # attr_reader statements: StatementsNode? # - # source://prism//lib/prism/node.rb#19950 + # source://prism//lib/prism/node.rb#18122 sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Return a symbol representation of this node type. See `Node#type`. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol - # - # source://prism//lib/prism/node.rb#19999 + # source://prism//lib/prism/node.rb#18145 sig { override.returns(Symbol) } def type; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#19923 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#20009 + # source://prism//lib/prism/node.rb#18150 def type; end end end @@ -36615,107 +41372,109 @@ end # `foo` # ^^^^^ # -# source://prism//lib/prism/node.rb#20029 +# source://prism//lib/prism/node.rb#18171 class Prism::XStringNode < ::Prism::Node include ::Prism::HeredocQuery - # def initialize: (Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped, Location location) -> void + # Initialize a new XStringNode node. # # @return [XStringNode] a new instance of XStringNode # - # source://prism//lib/prism/node.rb#20031 + # source://prism//lib/prism/node.rb#18173 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, flags: Integer, opening_loc: Prism::Location, content_loc: Prism::Location, closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location + unescaped: String ).void end - def initialize(source, flags, opening_loc, content_loc, closing_loc, unescaped, location); end + def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#20170 + # source://prism//lib/prism/node.rb#18301 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#20043 + # source://prism//lib/prism/node.rb#18185 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#20048 + # source://prism//lib/prism/node.rb#18190 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # - # source://prism//lib/prism/node.rb#20124 + # source://prism//lib/prism/node.rb#18280 sig { returns(String) } def closing; end # attr_reader closing_loc: Location # - # source://prism//lib/prism/node.rb#20094 + # source://prism//lib/prism/node.rb#18254 sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#20058 + # source://prism//lib/prism/node.rb#18200 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#20053 + # source://prism//lib/prism/node.rb#18195 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def content: () -> String # - # source://prism//lib/prism/node.rb#20119 + # source://prism//lib/prism/node.rb#18275 sig { returns(String) } def content; end # attr_reader content_loc: Location # - # source://prism//lib/prism/node.rb#20087 + # source://prism//lib/prism/node.rb#18241 sig { returns(Prism::Location) } def content_loc; end - # def copy: (?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String, ?location: Location) -> XStringNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode # - # source://prism//lib/prism/node.rb#20063 + # source://prism//lib/prism/node.rb#18205 sig do params( + node_id: Integer, + location: Prism::Location, flags: Integer, opening_loc: Prism::Location, content_loc: Prism::Location, closing_loc: Prism::Location, - unescaped: String, - location: Prism::Location + unescaped: String ).returns(Prism::XStringNode) end - def copy(flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#20048 + # source://prism//lib/prism/node.rb#18190 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String } # - # source://prism//lib/prism/node.rb#20071 + # source://prism//lib/prism/node.rb#18213 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end @@ -36726,7 +41485,7 @@ class Prism::XStringNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#20109 + # source://prism//lib/prism/node.rb#18223 sig { returns(T::Boolean) } def forced_binary_encoding?; end @@ -36734,80 +41493,72 @@ class Prism::XStringNode < ::Prism::Node # # @return [Boolean] # - # source://prism//lib/prism/node.rb#20104 + # source://prism//lib/prism/node.rb#18218 sig { returns(T::Boolean) } def forced_utf8_encoding?; end sig { returns(T::Boolean) } def heredoc?; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#20129 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#18285 + sig { override.returns(String) } + def inspect; end # def opening: () -> String # - # source://prism//lib/prism/node.rb#20114 + # source://prism//lib/prism/node.rb#18270 sig { returns(String) } def opening; end # attr_reader opening_loc: Location # - # source://prism//lib/prism/node.rb#20080 + # source://prism//lib/prism/node.rb#18228 sig { returns(Prism::Location) } def opening_loc; end + # Save the closing_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18262 + def save_closing_loc(repository); end + + # Save the content_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18249 + def save_content_loc(repository); end + + # Save the opening_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18236 + def save_opening_loc(repository); end + # Occasionally it's helpful to treat a string as if it were interpolated so # that there's a consistent interface for working with strings. # - # source://prism//lib/prism/node_ext.rb#72 + # source://prism//lib/prism/node_ext.rb#90 sig { returns(Prism::InterpolatedXStringNode) } def to_interpolated; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. - # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. - # - # def type: () -> Symbol + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#20154 + # source://prism//lib/prism/node.rb#18290 sig { override.returns(Symbol) } def type; end # attr_reader unescaped: String # - # source://prism//lib/prism/node.rb#20101 + # source://prism//lib/prism/node.rb#18267 sig { returns(String) } def unescaped; end - protected - - # protected attr_reader flags: Integer - # - # source://prism//lib/prism/node.rb#20076 - sig { returns(Integer) } - def flags; end - class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. + # Return a symbol representation of this node type. See `Node::type`. # - # def self.type: () -> Symbol - # - # source://prism//lib/prism/node.rb#20164 + # source://prism//lib/prism/node.rb#18295 def type; end end end @@ -36817,167 +41568,165 @@ end # yield 1 # ^^^^^^^ # -# source://prism//lib/prism/node.rb#20184 +# source://prism//lib/prism/node.rb#18315 class Prism::YieldNode < ::Prism::Node - # def initialize: (Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, Location location) -> void + # Initialize a new YieldNode node. # # @return [YieldNode] a new instance of YieldNode # - # source://prism//lib/prism/node.rb#20186 + # source://prism//lib/prism/node.rb#18317 sig do params( source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, lparen_loc: T.nilable(Prism::Location), arguments: T.nilable(Prism::ArgumentsNode), - rparen_loc: T.nilable(Prism::Location), - location: Prism::Location + rparen_loc: T.nilable(Prism::Location) ).void end - def initialize(source, keyword_loc, lparen_loc, arguments, rparen_loc, location); end + def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc); end # Implements case-equality for the node. This is effectively == but without # comparing the value of locations. Locations are checked only for presence. # - # source://prism//lib/prism/node.rb#20327 + # source://prism//lib/prism/node.rb#18449 def ===(other); end # def accept: (Visitor visitor) -> void # - # source://prism//lib/prism/node.rb#20197 + # source://prism//lib/prism/node.rb#18329 sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # - # source://prism//lib/prism/node.rb#20252 + # source://prism//lib/prism/node.rb#18396 sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#20202 + # source://prism//lib/prism/node.rb#18334 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # - # source://prism//lib/prism/node.rb#20214 + # source://prism//lib/prism/node.rb#18346 sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # - # source://prism//lib/prism/node.rb#20207 + # source://prism//lib/prism/node.rb#18339 sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end - # def copy: (?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?location: Location) -> YieldNode + # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode # - # source://prism//lib/prism/node.rb#20219 + # source://prism//lib/prism/node.rb#18351 sig do params( + node_id: Integer, + location: Prism::Location, + flags: Integer, keyword_loc: Prism::Location, lparen_loc: T.nilable(Prism::Location), arguments: T.nilable(Prism::ArgumentsNode), - rparen_loc: T.nilable(Prism::Location), - location: Prism::Location + rparen_loc: T.nilable(Prism::Location) ).returns(Prism::YieldNode) end - def copy(keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), location: T.unsafe(nil)); end + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # - # source://prism//lib/prism/node.rb#20202 + # source://prism//lib/prism/node.rb#18334 sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end - # def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, location: Location } + # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location? } # - # source://prism//lib/prism/node.rb#20227 + # source://prism//lib/prism/node.rb#18359 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } def fields; end - # def inspect(NodeInspector inspector) -> String + # def inspect -> String # - # source://prism//lib/prism/node.rb#20283 - sig { params(inspector: T.untyped).returns(String) } - def inspect(inspector = T.unsafe(nil)); end + # source://prism//lib/prism/node.rb#18433 + sig { override.returns(String) } + def inspect; end # def keyword: () -> String # - # source://prism//lib/prism/node.rb#20268 + # source://prism//lib/prism/node.rb#18418 sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # - # source://prism//lib/prism/node.rb#20232 + # source://prism//lib/prism/node.rb#18364 sig { returns(Prism::Location) } def keyword_loc; end # def lparen: () -> String? # - # source://prism//lib/prism/node.rb#20273 + # source://prism//lib/prism/node.rb#18423 sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # - # source://prism//lib/prism/node.rb#20239 + # source://prism//lib/prism/node.rb#18377 sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def rparen: () -> String? # - # source://prism//lib/prism/node.rb#20278 + # source://prism//lib/prism/node.rb#18428 sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # - # source://prism//lib/prism/node.rb#20255 + # source://prism//lib/prism/node.rb#18399 sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end - # Sometimes you want to check an instance of a node against a list of - # classes to see what kind of behavior to perform. Usually this is done by - # calling `[cls1, cls2].include?(node.class)` or putting the node into a - # case statement and doing `case node; when cls1; when cls2; end`. Both of - # these approaches are relatively slow because of the constant lookups, - # method calls, and/or array allocations. + # Save the keyword_loc location using the given saved source so that + # it can be retrieved later. # - # Instead, you can call #type, which will return to you a symbol that you - # can use for comparison. This is faster than the other approaches because - # it uses a single integer comparison, but also because if you're on CRuby - # you can take advantage of the fact that case statements with all symbol - # keys will use a jump table. + # source://prism//lib/prism/node.rb#18372 + def save_keyword_loc(repository); end + + # Save the lparen_loc location using the given saved source so that + # it can be retrieved later. + # + # source://prism//lib/prism/node.rb#18391 + def save_lparen_loc(repository); end + + # Save the rparen_loc location using the given saved source so that + # it can be retrieved later. # - # def type: () -> Symbol + # source://prism//lib/prism/node.rb#18413 + def save_rparen_loc(repository); end + + # Return a symbol representation of this node type. See `Node#type`. # - # source://prism//lib/prism/node.rb#20311 + # source://prism//lib/prism/node.rb#18438 sig { override.returns(Symbol) } def type; end class << self - # Similar to #type, this method returns a symbol that you can use for - # splitting on the type of the node without having to do a long === chain. - # Note that like #type, it will still be slower than using == for a single - # class, but should be faster in a case statement or an array comparison. - # - # def self.type: () -> Symbol + # Return a symbol representation of this node type. See `Node::type`. # - # source://prism//lib/prism/node.rb#20321 + # source://prism//lib/prism/node.rb#18443 def type; end end end - -# We keep this shim in here because our client libraries might not have -# ruby_parser in their bundle. -class Sexp < ::Array - Elem = type_member { { fixed: T.untyped }} -end