class Savi::AST::Loop
  
  - Savi::AST::Loop
 - Savi::AST::Node
 - Reference
 - Object
 
Overview
A Loop node indicates a looping flow control, with a #body Term which
may be executed zero or more times. The #initial_cond Term is evaluated
once at the start to determine whether any looping should be done.
After the first execution of the #body Term, then the #repeat_cond Term
is evaluated to determine whether looping will continue.
If the #initial_cond returned False, the result value of the loop is
the result of evaluating the #else_body Term; otherwise, the result
of the final execution of the #body Term will be used as the result value.
In simple cases, the #repeat_cond is the same as the #initial_cond and
the #else_body just returns a simple value of the None module.
This is an internal AST type which has no corresponding source code syntax, because such a construct is only created inside macro expansions.
However, the most obvious example of use is in the while macro.
Defined in:
savi/ast.crConstructors
Instance Method Summary
- #body : Term
 - #body=(body : Term)
 - #children_accept(ctx : Compiler::Context, visitor : Visitor)
 - #children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
 - #else_body : Term
 - #else_body=(else_body : Term)
 - #initial_cond : Term
 - #initial_cond=(initial_cond : Term)
 - #name
 - #repeat_cond : Term
 - #repeat_cond=(repeat_cond : Term)
 - #span_pos(source)
 - #to_a : Array(A)
 
Instance methods inherited from class Savi::AST::Node
  
  
    
      accept(ctx : Compiler::Context, visitor : Visitor)accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor) accept, annotations : Array(Annotation) | Nil annotations, annotations=(annotations : Array(Annotation) | Nil) annotations=, children_accept(ctx : Compiler::Context, visitor : Visitor)
children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor) children_accept, from(other : Node) from, pos pos, pos? : Savi::Source::Pos? pos?, span_pos(source) span_pos, with_pos(pos : Source::Pos) with_pos