class SyntaxTree::IfNode
Experimental RBS support (using type sampling data from the type_fusion project).
# sig/syntax_tree/node.rbs class SyntaxTree::IfNode < SyntaxTree::Node def accept: (Visitor visitor) -> untyped def child_nodes: () -> untyped def initialize: (predicate: (SyntaxTree::VarRef | SyntaxTree::CallNode | SyntaxTree::Binary), statements: SyntaxTree::Statements, consequent: SyntaxTree::Else?, location: SyntaxTree::Location) -> void end
end
if predicate
If represents the first clause in an if chain.
def ===(other)
def ===(other) other.is_a?(IfNode) && predicate === other.predicate && statements === other.statements && consequent === other.consequent end
def accept(visitor)
Experimental RBS support (using type sampling data from the type_fusion project).
def accept: (Visitor visitor) -> untyped
This signature was generated using 2 samples from 1 application.
def accept(visitor) visitor.visit_if(self) end
def child_nodes
Experimental RBS support (using type sampling data from the type_fusion project).
def child_nodes: () -> untyped
This signature was generated using 5 samples from 1 application.
def child_nodes [predicate, statements, consequent] end
def copy(predicate: nil, statements: nil, consequent: nil, location: nil)
def copy(predicate: nil, statements: nil, consequent: nil, location: nil) node = IfNode.new( predicate: predicate || self.predicate, statements: statements || self.statements, consequent: consequent || self.consequent, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { predicate: predicate, statements: statements, consequent: consequent, location: location, comments: comments } end
def format(q)
def format(q) ConditionalFormatter.new("if", self).format(q) end
def initialize(predicate:, statements:, consequent:, location:)
Experimental RBS support (using type sampling data from the type_fusion project).
def initialize: (predicate: (SyntaxTree::VarRef | SyntaxTree::CallNode | SyntaxTree::Binary), statements: SyntaxTree::Statements, consequent: SyntaxTree::Else?, location: SyntaxTree::Location) -> void
This signature was generated using 6 samples from 1 application.
def initialize(predicate:, statements:, consequent:, location:) @predicate = predicate @statements = statements @consequent = consequent @location = location @comments = [] end
def modifier?
def modifier? predicate.location.start_char > statements.location.start_char end