sig/prism.rbs in prism-0.17.1 vs sig/prism.rbs in prism-0.18.0

- old
+ new

@@ -603,10 +603,39 @@ def operator: () -> String def inspect: (inspector: NodeInspector) -> String end + # Represents the use of a case statement for pattern matching. + # + # case true + # in false + # end + # ^^^^^^^^^ + class CaseMatchNode < Node + attr_reader predicate: Node? + attr_reader conditions: Array[Node] + attr_reader consequent: ElseNode? + attr_reader case_keyword_loc: Location + attr_reader end_keyword_loc: Location + + def initialize: (predicate: Node?, conditions: Array[Node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_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) -> CaseMatchNode + + def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] + + def case_keyword: () -> String + + def end_keyword: () -> String + + def inspect: (inspector: NodeInspector) -> String + end # Represents the use of a case statement. # # case true # when false # end @@ -1630,15 +1659,16 @@ # if foo then bar end # ^^^^^^^^^^^^^^^^^^^ class IfNode < Node attr_reader if_keyword_loc: Location? attr_reader predicate: Node + attr_reader then_keyword_loc: Location? attr_reader statements: StatementsNode? attr_reader consequent: Node? attr_reader end_keyword_loc: Location? - def initialize: (if_keyword_loc: Location?, predicate: Node, statements: StatementsNode?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> void + def initialize: (if_keyword_loc: Location?, predicate: Node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: Node?, end_keyword_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?] @@ -1646,10 +1676,12 @@ def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] def if_keyword: () -> String? + def then_keyword: () -> String? + def end_keyword: () -> String? def inspect: (inspector: NodeInspector) -> String end # Represents an imaginary number literal. @@ -2469,13 +2501,13 @@ # # /(?<foo>bar)/ =~ baz # ^^^^^^^^^^^^^^^^^^^^ class MatchWriteNode < Node attr_reader call: CallNode - attr_reader locals: Array[Symbol] + attr_reader targets: Array[Node] - def initialize: (call: CallNode, locals: Array[Symbol], location: Location) -> void + def initialize: (call: CallNode, targets: Array[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?] @@ -3332,30 +3364,10 @@ def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] def inspect: (inspector: NodeInspector) -> String end - # Represents the use of compile-time string concatenation. - # - # "foo" "bar" - # ^^^^^^^^^^^ - class StringConcatNode < Node - attr_reader left: Node - attr_reader right: Node - - def initialize: (left: Node, right: 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) -> StringConcatNode - - def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] - - def inspect: (inspector: NodeInspector) -> String - end # Represents a string literal, a string contained within a `%w` list, or # plain string content within an interpolated string. # # "foo" # ^^^^^ @@ -3503,15 +3515,16 @@ # unless foo then bar end # ^^^^^^^^^^^^^^^^^^^^^^^ class UnlessNode < Node attr_reader keyword_loc: Location attr_reader predicate: Node + attr_reader then_keyword_loc: Location? attr_reader statements: StatementsNode? attr_reader consequent: ElseNode? attr_reader end_keyword_loc: Location? - def initialize: (keyword_loc: Location, predicate: Node, statements: StatementsNode?, consequent: ElseNode?, end_keyword_loc: Location?, location: Location) -> void + def initialize: (keyword_loc: Location, predicate: Node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: ElseNode?, end_keyword_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?] @@ -3519,10 +3532,12 @@ def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, (Node | Array[Node] | String | Token | Array[Token] | Location)?] def keyword: () -> String + def then_keyword: () -> String? + def end_keyword: () -> String? def inspect: (inspector: NodeInspector) -> String end # Represents the use of the `until` keyword, either in the block form or the modifier form. @@ -3801,10 +3816,13 @@ def visit_call_or_write_node: (node: CallOrWriteNode) -> void # Visit a CapturePatternNode node def visit_capture_pattern_node: (node: CapturePatternNode) -> void + # Visit a CaseMatchNode node + def visit_case_match_node: (node: CaseMatchNode) -> void + # Visit a CaseNode node def visit_case_node: (node: CaseNode) -> void # Visit a ClassNode node def visit_class_node: (node: ClassNode) -> void @@ -4131,13 +4149,10 @@ def visit_splat_node: (node: SplatNode) -> void # Visit a StatementsNode node def visit_statements_node: (node: StatementsNode) -> void - # Visit a StringConcatNode node - def visit_string_concat_node: (node: StringConcatNode) -> void - # Visit a StringNode node def visit_string_node: (node: StringNode) -> void # Visit a SuperNode node def visit_super_node: (node: SuperNode) -> void @@ -4218,10 +4233,12 @@ def CallOperatorWriteNode: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, flags: Integer, read_name: Symbol, write_name: Symbol, operator: Symbol, operator_loc: Location, value: Node, location: Location) -> CallOperatorWriteNode # Create a new CallOrWriteNode node def CallOrWriteNode: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, flags: Integer, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node, location: Location) -> CallOrWriteNode # Create a new CapturePatternNode node def CapturePatternNode: (value: Node, target: Node, operator_loc: Location, location: Location) -> CapturePatternNode + # Create a new CaseMatchNode node + def CaseMatchNode: (predicate: Node?, conditions: Array[Node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location, location: Location) -> CaseMatchNode # Create a new CaseNode node def CaseNode: (predicate: Node?, conditions: Array[Node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location, location: Location) -> CaseNode # Create a new ClassNode node def ClassNode: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, body: Node?, end_keyword_loc: Location, name: Symbol, location: Location) -> ClassNode # Create a new ClassVariableAndWriteNode node @@ -4303,11 +4320,11 @@ # Create a new HashNode node def HashNode: (opening_loc: Location, elements: Array[Node], closing_loc: Location, location: Location) -> HashNode # Create a new HashPatternNode node def HashPatternNode: (constant: Node?, elements: Array[Node], rest: Node?, opening_loc: Location?, closing_loc: Location?, location: Location) -> HashPatternNode # Create a new IfNode node - def IfNode: (if_keyword_loc: Location?, predicate: Node, statements: StatementsNode?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> IfNode + def IfNode: (if_keyword_loc: Location?, predicate: Node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> IfNode # Create a new ImaginaryNode node def ImaginaryNode: (numeric: Node, location: Location) -> ImaginaryNode # Create a new ImplicitNode node def ImplicitNode: (value: Node, location: Location) -> ImplicitNode # Create a new InNode node @@ -4365,11 +4382,11 @@ # Create a new MatchPredicateNode node def MatchPredicateNode: (value: Node, pattern: Node, operator_loc: Location, location: Location) -> MatchPredicateNode # Create a new MatchRequiredNode node def MatchRequiredNode: (value: Node, pattern: Node, operator_loc: Location, location: Location) -> MatchRequiredNode # Create a new MatchWriteNode node - def MatchWriteNode: (call: CallNode, locals: Array[Symbol], location: Location) -> MatchWriteNode + def MatchWriteNode: (call: CallNode, targets: Array[Node], location: Location) -> MatchWriteNode # Create a new MissingNode node def MissingNode: (location: Location) -> MissingNode # Create a new ModuleNode node def ModuleNode: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, body: Node?, end_keyword_loc: Location, name: Symbol, location: Location) -> ModuleNode # Create a new MultiTargetNode node @@ -4438,12 +4455,10 @@ def SourceLineNode: (location: Location) -> SourceLineNode # Create a new SplatNode node def SplatNode: (operator_loc: Location, expression: Node?, location: Location) -> SplatNode # Create a new StatementsNode node def StatementsNode: (body: Array[Node], location: Location) -> StatementsNode - # Create a new StringConcatNode node - def StringConcatNode: (left: Node, right: Node, location: Location) -> StringConcatNode # Create a new StringNode node def StringNode: (flags: Integer, opening_loc: Location?, content_loc: Location, closing_loc: Location?, unescaped: String, location: Location) -> StringNode # Create a new SuperNode node def SuperNode: (keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, block: Node?, location: Location) -> SuperNode # Create a new SymbolNode node @@ -4451,10 +4466,10 @@ # Create a new TrueNode node def TrueNode: (location: Location) -> TrueNode # Create a new UndefNode node def UndefNode: (names: Array[Node], keyword_loc: Location, location: Location) -> UndefNode # Create a new UnlessNode node - def UnlessNode: (keyword_loc: Location, predicate: Node, statements: StatementsNode?, consequent: ElseNode?, end_keyword_loc: Location?, location: Location) -> UnlessNode + def UnlessNode: (keyword_loc: Location, predicate: Node, then_keyword_loc: Location?, statements: StatementsNode?, consequent: ElseNode?, end_keyword_loc: Location?, location: Location) -> UnlessNode # Create a new UntilNode node def UntilNode: (keyword_loc: Location, closing_loc: Location?, predicate: Node, statements: StatementsNode?, flags: Integer, location: Location) -> UntilNode # Create a new WhenNode node def WhenNode: (keyword_loc: Location, conditions: Array[Node], statements: StatementsNode?, location: Location) -> WhenNode # Create a new WhileNode node