class SyntaxTree::Parser
def on_if(predicate, statements, consequent)
Experimental RBS support (using type sampling data from the type_fusion project).
def on_if: ((SyntaxTree::VarRef | SyntaxTree::CallNode) predicate, SyntaxTree::Statements statements, SyntaxTree::Else? consequent) -> untyped
This signature was generated using 2 samples from 1 application.
(nil | Elsif | Else) consequent
Statements statements,
untyped predicate,
on_if: (
:call-seq:
def on_if(predicate, statements, consequent) beginning = consume_keyword(:if) ending = consequent || consume_keyword(:end) if (keyword = find_keyword_between(:then, predicate, ending)) tokens.delete(keyword) end start_char = find_next_statement_start((keyword || predicate).location.end_char) statements.bind( self, start_char, start_char - line_counts[predicate.location.end_line - 1].start, ending.location.start_char, ending.location.start_column ) IfNode.new( predicate: predicate, statements: statements, consequent: consequent, location: beginning.location.to(ending.location) ) end