class Ameba::AST::Branch
  
  - Ameba::AST::Branch
- Reference
- Object
Overview
Represents the branch in Crystal code. Branch is a part of a branchable statement. For example, the branchable if statement contains 3 branches:
if a = something # --> Branch A
  a = 1          # --> Branch B
  put a if out   # --> Branch C
else
  do_something a # --> Branch D
endDefined in:
ameba/ast/branch.crConstructors
- 
        .new(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)
        
          Creates a new branch. 
Class Method Summary
- 
        .of(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)
        
          Constructs a new branch based on the node some parent scope. 
- 
        .of(node : Crystal::ASTNode, scope : Scope)
        
          Constructs a new branch based on the node in scope. 
Instance Method Summary
- 
        #==(other : self)
        
          Returns trueif this reference is the same as other.
- #end_location(*args, **options)
- #end_location(*args, **options, &)
- 
        #hash(hasher)
        
          See Object#hash(hasher)
- 
        #in_loop?
        
          Returns trueif current branch is in a loop,false- otherwise.
- #location(*args, **options)
- #location(*args, **options, &)
- 
        #node : Crystal::ASTNode
        
          The actual branch node. 
- 
        #parent : Branchable
        
          The parent branchable. 
- #to_s(*args, **options)
- #to_s(*args, **options, &)
Constructor Detail
Creates a new branch.
Branch.new(if_node)Class Method Detail
Constructs a new branch based on the node some parent scope.
Branch.of(assign_node, def_node)Constructs a new branch based on the node in scope.
Branch.of(assign_node, scope)Instance Method Detail
Returns true if this reference is the same as other. Invokes same?.
Returns true if current branch is in a loop, false - otherwise.
For example, this branch is in a loop:
while true
  handle_input # this branch is in a loop
  if wrong_input
    show_message # this branch is also in a loop.
  end
end