class Prism::CaseNode
^^^^^^^^^^
end
when false
case true
Represents the use of a case statement.
def self.type
def self.type :case_node end
def ===(other)
Implements case-equality for the node. This is effectively == but without
def ===(other) other.is_a?(CaseNode) && (predicate === other.predicate) && (conditions.length == other.conditions.length) && conditions.zip(other.conditions).all? { |left, right| left === right } && (else_clause === other.else_clause) && (case_keyword_loc.nil? == other.case_keyword_loc.nil?) && (end_keyword_loc.nil? == other.end_keyword_loc.nil?) end
def accept(visitor)
def accept(visitor) visitor.visit_case_node(self) end
def case_keyword
def case_keyword case_keyword_loc.slice end
def case_keyword_loc
def case_keyword_loc location = @case_keyword_loc return location if location.is_a?(Location) @case_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
def child_nodes
def child_nodes [predicate, *conditions, else_clause] end
def comment_targets
def comment_targets [*predicate, *conditions, *else_clause, case_keyword_loc, end_keyword_loc] #: Array[Prism::node | Location] end
def compact_child_nodes
def compact_child_nodes compact = [] #: Array[Prism::node] compact << predicate if predicate compact.concat(conditions) compact << else_clause if else_clause compact end
def consequent
Returns the else clause of the case node. This method is deprecated in
def consequent deprecated("else_clause") else_clause end
def copy(node_id: self.node_id, location: self.location, flags: self.flags, predicate: self.predicate, conditions: self.conditions, else_clause: self.else_clause, case_keyword_loc: self.case_keyword_loc, end_keyword_loc: self.end_keyword_loc)
def copy(node_id: self.node_id, location: self.location, flags: self.flags, predicate: self.predicate, conditions: self.conditions, else_clause: self.else_clause, case_keyword_loc: self.case_keyword_loc, end_keyword_loc: self.end_keyword_loc) CaseNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc) end
def deconstruct_keys(keys)
def deconstruct_keys(keys) { node_id: node_id, location: location, predicate: predicate, conditions: conditions, else_clause: else_clause, case_keyword_loc: case_keyword_loc, end_keyword_loc: end_keyword_loc } end
def end_keyword
def end_keyword end_keyword_loc.slice end
def end_keyword_loc
def end_keyword_loc location = @end_keyword_loc return location if location.is_a?(Location) @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc)
def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc) @source = source @node_id = node_id @location = location @flags = flags @predicate = predicate @conditions = conditions @else_clause = else_clause @case_keyword_loc = case_keyword_loc @end_keyword_loc = end_keyword_loc end
def inspect
def inspect InspectVisitor.compose(self) end
def type
def type :case_node end