class Savi::AST::Try
- Savi::AST::Try
- Savi::AST::Node
- Reference
- Object
Overview
A Try node indicates a fallback flow control where a block interrupted by
a possible runtime error in the #body
Term will fall back to executing
the #else_body
Term to obtain a result value for the overall result.
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 try
macro.
Defined in:
savi/ast.crConstructors
Instance Method Summary
- #allow_non_partial_body : Bool
- #allow_non_partial_body=(allow_non_partial_body : Bool)
- #body : Term
- #body=(body : Term)
- #catch_expr : Term | Nil
- #catch_expr=(catch_expr : Term | Nil)
- #children_accept(ctx : Compiler::Context, visitor : Visitor)
- #children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
- #else_body : Term
- #else_body=(else_body : Term)
- #name
- #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
Constructor Detail
def self.new(body : Savi::AST::Node, catch_expr : Savi::AST::Node | Nil, else_body : Savi::AST::Node, allow_non_partial_body : Bool = false)
#