class SyntaxTree::Parser
def on_bodystmt(statements, rescue_clause, else_clause, ensure_clause)
Experimental RBS support (using type sampling data from the type_fusion
project).
def on_bodystmt: (SyntaxTree::Statements statements, nil rescue_clause, nil else_clause, nil ensure_clause) -> untyped
This signature was generated using 7 samples from 1 application.
(nil | Ensure) ensure_clause
(nil | Statements) else_clause,
(nil | Rescue) rescue_clause,
Statements statements,
on_bodystmt: (
:call-seq:
def on_bodystmt(statements, rescue_clause, else_clause, ensure_clause) # In certain versions of Ruby, the `statements` argument can be any node # in the case that we're inside of an endless method definition. In this # case we'll wrap it in a Statements node to be consistent. unless statements.is_a?(Statements) statements = Statements.new(body: [statements], location: statements.location) end parts = [statements, rescue_clause, else_clause, ensure_clause].compact BodyStmt.new( statements: statements, rescue_clause: rescue_clause, else_keyword: else_clause && consume_keyword(:else), else_clause: else_clause, ensure_clause: ensure_clause, location: parts.first.location.to(parts.last.location) ) end