class Ameba::AST::ImplicitReturnVisitor
- Ameba::AST::ImplicitReturnVisitor
- Ameba::AST::BaseVisitor
- Crystal::Visitor
- Reference
- Object
Overview
AST visitor that finds nodes that are not used by their surrounding scope.
A stack is used to keep track of when a node is used, incrementing every time something will capture its implicit (or explicit) return value, such as the path in a class name or the value in an assign.
This also allows for passing through whether a node is captured from a nodes
parent to its children, such as from an if
statements parent to it's body,
as the body is not used by the if
itself, but by its parent scope.
Defined in:
ameba/ast/visitors/implicit_return_visitor.crInstance Method Summary
-
#visit(node : Crystal::Expressions) : Bool
The stack is swapped out here as
Crystal::Expressions
are isolated from their parents scope. - #visit(node : Crystal::BinaryOp) : Bool
- #visit(node : Crystal::Call) : Bool
- #visit(node : Crystal::Arg) : Bool
- #visit(node : Crystal::EnumDef) : Bool
- #visit(node : Crystal::Assign | Crystal::OpAssign) : Bool
- #visit(node : Crystal::MultiAssign) : Bool
- #visit(node : Crystal::If | Crystal::Unless) : Bool
- #visit(node : Crystal::While | Crystal::Until) : Bool
- #visit(node : Crystal::Def) : Bool
- #visit(node : Crystal::ClassDef | Crystal::ModuleDef) : Bool
- #visit(node : Crystal::FunDef) : Bool
- #visit(node : Crystal::Cast | Crystal::NilableCast) : Bool
- #visit(node : Crystal::Annotation) : Bool
- #visit(node : Crystal::TypeDeclaration) : Bool
- #visit(node : Crystal::ArrayLiteral | Crystal::TupleLiteral) : Bool
- #visit(node : Crystal::StringInterpolation) : Bool
- #visit(node : Crystal::HashLiteral | Crystal::NamedTupleLiteral) : Bool
- #visit(node : Crystal::Case) : Bool
- #visit(node : Crystal::Select) : Bool
- #visit(node : Crystal::When) : Bool
- #visit(node : Crystal::Rescue) : Bool
- #visit(node : Crystal::ExceptionHandler) : Bool
- #visit(node : Crystal::ControlExpression) : Bool
- #visit(node : Crystal::RangeLiteral) : Bool
- #visit(node : Crystal::RegexLiteral) : Bool
- #visit(node : Crystal::BoolLiteral | Crystal::CharLiteral | Crystal::NumberLiteral | Crystal::StringLiteral | Crystal::SymbolLiteral | Crystal::ProcLiteral) : Bool
- #visit(node : Crystal::Yield) : Bool
- #visit(node : Crystal::Generic | Crystal::Path | Crystal::Union) : Bool
- #visit(node : Crystal::Macro | Crystal::MacroIf | Crystal::MacroFor) : Bool
- #visit(node : Crystal::UninitializedVar) : Bool
- #visit(node : Crystal::LibDef) : Bool
- #visit(node : Crystal::Include | Crystal::Extend) : Bool
- #visit(node : Crystal::Alias)
- #visit(node : Crystal::TypeDef)
- #visit(node)
Instance methods inherited from class Ameba::AST::BaseVisitor
visit(node : Crystal::ASTNode)
visit
Constructor methods inherited from class Ameba::AST::BaseVisitor
new(rule : Ameba::Rule::Base, source : Ameba::Source)
new
Instance Method Detail
The stack is swapped out here as Crystal::Expressions
are isolated from
their parents scope. Only the last line in an expressions node can be
captured by their parent node.