class
   Ameba::AST::Branchable
  
  - Ameba::AST::Branchable
- Reference
- Object
Overview
A generic entity to represent a branchable Crystal node.
For example, Crystal::If, Crystal::Unless, Crystal::While
are branchables.
while a > 100 # Branchable A
  if b > 2    # Branchable B
    a += 1
  end
endIncluded Modules
Defined in:
ameba/ast/branchable.crConstructors
- 
        .new(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)
        
          Creates a new branchable 
Instance Method Summary
- 
        #branches : Array(Crystal::ASTNode)
        
          Array of branches 
- #end_location(*args, **options)
- #end_location(*args, **options, &)
- #location(*args, **options)
- #location(*args, **options, &)
- 
        #loop?
        
          Returns trueif this node or one of the parent branchables is a loop,falseotherwise.
- 
        #node : Crystal::ASTNode
        
          The actual Crystal node 
- 
        #parent : Branchable | Nil
        
          Parent branchable (if any) 
- #to_s(*args, **options)
- #to_s(*args, **options, &)
Instance methods inherited from module Ameba::AST::Util
  
  
    
      abort?(node)
    abort?, 
    
  
    
      control_exp_code(node : Crystal::ControlExpression, code_lines)
    control_exp_code, 
    
  
    
      dynamic_literal?(node) : Bool
    dynamic_literal?, 
    
  
    
      exit?(node)
    exit?, 
    
  
    
      flow_command?(node, in_loop)
    flow_command?, 
    
  
    
      flow_expression?(node, in_loop = false)
    flow_expression?, 
    
  
    
      has_block?(node) : Bool
    has_block?, 
    
  
    
      literal?(node) : Bool
    literal?, 
    
  
    
      loop?(node)
    loop?, 
    
  
    
      name_end_location(node)
    name_end_location, 
    
  
    
      name_location(node)
    name_location, 
    
  
    
      name_location_or(token : Crystal::Token, name, *, adjust_location_column_number = nil)name_location_or(node : Crystal::ASTNode, *, adjust_location_column_number = nil) name_location_or, name_size(node) name_size, node_source(node, code_lines) node_source, nodoc?(node) nodoc?, path_named?(node, *names : String) : Bool path_named?, raise?(node) raise?, source_between(loc, end_loc, code_lines) : String | Nil source_between, static_literal?(node) : Bool static_literal?
Constructor Detail
Creates a new branchable
Branchable.new(node, parent_branchable)