sig/prism.rbs in prism-0.16.0 vs sig/prism.rbs in prism-0.17.0

- old
+ new

@@ -605,14 +605,14 @@ def inspect: (inspector: NodeInspector) -> String end # Represents the use of a case statement. # - # case true - # ^^^^^^^^^ - # when false - # end + # case true + # when false + # end + # ^^^^^^^^^^ class CaseNode < Node attr_reader predicate: Node? attr_reader conditions: Array[Node] attr_reader consequent: ElseNode? attr_reader case_keyword_loc: Location @@ -667,11 +667,11 @@ def inspect: (inspector: NodeInspector) -> String end # Represents the use of the `&&=` operator for assignment to a class variable. # # @@target &&= value - # ^^^^^^^^^^^^^^^^ + # ^^^^^^^^^^^^^^^^^^ class ClassVariableAndWriteNode < Node attr_reader name: Symbol attr_reader name_loc: Location attr_reader operator_loc: Location attr_reader value: Node @@ -1266,17 +1266,17 @@ def inspect: (inspector: NodeInspector) -> String end # Represents a find pattern in pattern matching. # # foo in *bar, baz, *qux - # ^^^^^^^^^^^^^^^^^^^^^^ + # ^^^^^^^^^^^^^^^ # # foo in [*bar, baz, *qux] - # ^^^^^^^^^^^^^^^^^^^^^^^^ + # ^^^^^^^^^^^^^^^^^ # # foo in Foo(*bar, baz, *qux) - # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + # ^^^^^^^^^^^^^^^^^^^^ class FindPatternNode < Node attr_reader constant: Node? attr_reader left: Node attr_reader requireds: Array[Node] attr_reader right: Node @@ -1378,11 +1378,11 @@ end # Represents forwarding all arguments to this method to another method. # # def foo(...) # bar(...) - # ^^^^^^^^ + # ^^^ # end class ForwardingArgumentsNode < Node def initialize: (location: Location) -> void def accept: (visitor: Visitor) -> void @@ -2174,36 +2174,10 @@ def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] def inspect: (inspector: NodeInspector) -> String end - # Represents a keyword parameter to a method, block, or lambda definition. - # - # def a(b:) - # ^^ - # end - # - # def a(b: 1) - # ^^^^ - # end - class KeywordParameterNode < Node - attr_reader name: Symbol - attr_reader name_loc: Location - attr_reader value: Node? - - def initialize: (name: Symbol, name_loc: Location, value: Node?, location: Location) -> void - def accept: (visitor: Visitor) -> void - def set_newline_flag: (newline_marked: Array[bool]) -> void - def child_nodes: () -> Array[Node?] - def deconstruct: () -> Array[Node?] - - def copy: (**untyped) -> KeywordParameterNode - - def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] - - def inspect: (inspector: NodeInspector) -> String - end # Represents a keyword rest parameter to a method, block, or lambda definition. # # def a(**b) # ^^^ # end @@ -2695,10 +2669,32 @@ def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] def inspect: (inspector: NodeInspector) -> String end + # Represents an optional keyword parameter to a method, block, or lambda definition. + # + # def a(b: 1) + # ^^^^ + # end + class OptionalKeywordParameterNode < Node + attr_reader name: Symbol + attr_reader name_loc: Location + attr_reader value: Node + + def initialize: (name: Symbol, name_loc: Location, value: Node, location: Location) -> void + def accept: (visitor: Visitor) -> void + def set_newline_flag: (newline_marked: Array[bool]) -> void + def child_nodes: () -> Array[Node?] + def deconstruct: () -> Array[Node?] + + def copy: (**untyped) -> OptionalKeywordParameterNode + + def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] + + def inspect: (inspector: NodeInspector) -> String + end # Represents an optional parameter to a method, block, or lambda definition. # # def a(b = 1) # ^^^^^ # end @@ -3030,10 +3026,31 @@ def utf_8?: () -> bool def inspect: (inspector: NodeInspector) -> String end + # Represents a required keyword parameter to a method, block, or lambda definition. + # + # def a(b: ) + # ^^ + # end + class RequiredKeywordParameterNode < Node + attr_reader name: Symbol + attr_reader name_loc: Location + + def initialize: (name: Symbol, name_loc: Location, location: Location) -> void + def accept: (visitor: Visitor) -> void + def set_newline_flag: (newline_marked: Array[bool]) -> void + def child_nodes: () -> Array[Node?] + def deconstruct: () -> Array[Node?] + + def copy: (**untyped) -> RequiredKeywordParameterNode + + def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] + + def inspect: (inspector: NodeInspector) -> String + end # Represents a required parameter to a method, block, or lambda definition. # # def a(b) # ^ # end @@ -3052,12 +3069,12 @@ def inspect: (inspector: NodeInspector) -> String end # Represents an expression modified with a rescue. # - # foo rescue nil - # ^^^^^^^^^^^^^^ + # foo rescue nil + # ^^^^^^^^^^^^^^ class RescueModifierNode < Node attr_reader expression: Node attr_reader keyword_loc: Location attr_reader rescue_expression: Node @@ -3077,12 +3094,12 @@ 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. class RescueNode < Node @@ -3652,22 +3669,25 @@ def rparen: () -> String? def inspect: (inspector: NodeInspector) -> String end + # Flags for arguments nodes. module ArgumentsNodeFlags # if arguments contain keyword splat KEYWORD_SPLAT: Integer end + # Flags for call nodes. module CallNodeFlags # &. operator SAFE_NAVIGATION: Integer # a call that could have been a local variable VARIABLE_CALL: Integer end + # Flags for integer nodes that correspond to the base of the integer. module IntegerBaseFlags # 0b prefix BINARY: Integer # 0o or 0 prefix OCTAL: Integer @@ -3675,20 +3695,23 @@ DECIMAL: Integer # 0x prefix HEXADECIMAL: Integer end + # Flags for while and until loop nodes. module LoopFlags # a loop after a begin statement, so the body is executed first before the condition BEGIN_MODIFIER: Integer end + # Flags for range and flip-flop nodes. module RangeFlags # ... operator EXCLUDE_END: Integer end + # Flags for regular expression and match last line nodes. module RegularExpressionFlags # i - ignores the case of characters when matching IGNORE_CASE: Integer # x - ignores whitespace and allows comments in regular expressions EXTENDED: Integer @@ -3704,10 +3727,11 @@ WINDOWS_31J: Integer # u - forces the UTF-8 encoding UTF_8: Integer end + # Flags for string nodes. module StringFlags # frozen by virtue of a `frozen_string_literal` comment FROZEN: Integer end @@ -3963,13 +3987,10 @@ def visit_interpolated_x_string_node: (node: InterpolatedXStringNode) -> void # Visit a KeywordHashNode node def visit_keyword_hash_node: (node: KeywordHashNode) -> void - # Visit a KeywordParameterNode node - def visit_keyword_parameter_node: (node: KeywordParameterNode) -> void - # Visit a KeywordRestParameterNode node def visit_keyword_rest_parameter_node: (node: KeywordRestParameterNode) -> void # Visit a LambdaNode node def visit_lambda_node: (node: LambdaNode) -> void @@ -4026,10 +4047,13 @@ def visit_no_keywords_parameter_node: (node: NoKeywordsParameterNode) -> void # Visit a NumberedReferenceReadNode node def visit_numbered_reference_read_node: (node: NumberedReferenceReadNode) -> void + # Visit a OptionalKeywordParameterNode node + def visit_optional_keyword_parameter_node: (node: OptionalKeywordParameterNode) -> void + # Visit a OptionalParameterNode node def visit_optional_parameter_node: (node: OptionalParameterNode) -> void # Visit a OrNode node def visit_or_node: (node: OrNode) -> void @@ -4065,10 +4089,13 @@ def visit_redo_node: (node: RedoNode) -> void # Visit a RegularExpressionNode node def visit_regular_expression_node: (node: RegularExpressionNode) -> void + # Visit a RequiredKeywordParameterNode node + def visit_required_keyword_parameter_node: (node: RequiredKeywordParameterNode) -> void + # Visit a RequiredParameterNode node def visit_required_parameter_node: (node: RequiredParameterNode) -> void # Visit a RescueModifierNode node def visit_rescue_modifier_node: (node: RescueModifierNode) -> void @@ -4315,12 +4342,10 @@ def InterpolatedSymbolNode: (opening_loc: Location?, parts: Array[Node], closing_loc: Location?, location: Location) -> InterpolatedSymbolNode # Create a new InterpolatedXStringNode node def InterpolatedXStringNode: (opening_loc: Location, parts: Array[Node], closing_loc: Location, location: Location) -> InterpolatedXStringNode # Create a new KeywordHashNode node def KeywordHashNode: (elements: Array[Node], location: Location) -> KeywordHashNode - # Create a new KeywordParameterNode node - def KeywordParameterNode: (name: Symbol, name_loc: Location, value: Node?, location: Location) -> KeywordParameterNode # Create a new KeywordRestParameterNode node def KeywordRestParameterNode: (name: Symbol?, name_loc: Location?, operator_loc: Location, location: Location) -> KeywordRestParameterNode # Create a new LambdaNode node def LambdaNode: (locals: Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: BlockParametersNode?, body: Node?, location: Location) -> LambdaNode # Create a new LocalVariableAndWriteNode node @@ -4357,10 +4382,12 @@ def NilNode: (location: Location) -> NilNode # Create a new NoKeywordsParameterNode node def NoKeywordsParameterNode: (operator_loc: Location, keyword_loc: Location, location: Location) -> NoKeywordsParameterNode # Create a new NumberedReferenceReadNode node def NumberedReferenceReadNode: (number: Integer, location: Location) -> NumberedReferenceReadNode + # Create a new OptionalKeywordParameterNode node + def OptionalKeywordParameterNode: (name: Symbol, name_loc: Location, value: Node, location: Location) -> OptionalKeywordParameterNode # Create a new OptionalParameterNode node def OptionalParameterNode: (name: Symbol, name_loc: Location, operator_loc: Location, value: Node, location: Location) -> OptionalParameterNode # Create a new OrNode node def OrNode: (left: Node, right: Node, operator_loc: Location, location: Location) -> OrNode # Create a new ParametersNode node @@ -4383,9 +4410,11 @@ def RationalNode: (numeric: Node, location: Location) -> RationalNode # Create a new RedoNode node def RedoNode: (location: Location) -> RedoNode # Create a new RegularExpressionNode node def RegularExpressionNode: (opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, flags: Integer, location: Location) -> RegularExpressionNode + # Create a new RequiredKeywordParameterNode node + def RequiredKeywordParameterNode: (name: Symbol, name_loc: Location, location: Location) -> RequiredKeywordParameterNode # Create a new RequiredParameterNode node def RequiredParameterNode: (name: Symbol, location: Location) -> RequiredParameterNode # Create a new RescueModifierNode node def RescueModifierNode: (expression: Node, keyword_loc: Location, rescue_expression: Node, location: Location) -> RescueModifierNode # Create a new RescueNode node