class Savi::Compiler::Refer::Visitor
- Savi::Compiler::Refer::Visitor
- Savi::AST::Visitor
- Reference
- Object
Defined in:
savi/compiler/refer.crConstructors
Instance Method Summary
- #analysis : Savi::Compiler::Refer::Analysis
- #create_local(node : AST::Identifier, param_idx : Int32 | Nil = nil)
- #create_param_local(node)
- #create_yield_param_local(node)
- #locals
- #sub_branch(ctx, group : AST::Node | Nil, init_locals = locals, &)
-
#touch(ctx, node : AST::Identifier)
For an Identifier, resolve it to any known local or type if possible.
-
#touch(ctx, node : AST::FieldRead | AST::FieldWrite | AST::FieldDisplace)
For a FieldRead, FieldWrite, or FieldDisplace; take note of it by name.
- #touch(ctx, node : AST::Call)
- #touch(ctx, node : AST::Relate)
- #touch(ctx, node : AST::Try)
- #touch(ctx, node : AST::Node)
- #touch_yield_loop(ctx, params : AST::Group | Nil, block : AST::Group | Nil)
-
#visit(ctx, node)
This visitor never replaces nodes, it just touches them and returns them.
-
#visit_children?(ctx, node : AST::Call)
For a call node, defer the normal visit order, so that we can visit the receiver, identifier, and args in the normal order, but visit the yield params and yield block in a special sub-visitor.
Instance methods inherited from class Savi::AST::Visitor
visit(ctx : Compiler::Context, node : Node)
visit,
visit_any?(ctx : Compiler::Context, node : Node)
visit_any?,
visit_children?(ctx : Compiler::Context, node : Node)
visit_children?,
visit_pre(ctx : Compiler::Context, node : Node)
visit_pre
Constructor Detail
def self.new(analysis : Analysis, refer_type : ReferType::Analysis, classify : Classify::Analysis | Nil = nil, parent_locals : Hash(String, Savi::Compiler::Refer::Local) = {} of String => Local, locals_sequence_number : Int32 = 0)
#
Instance Method Detail
def touch(ctx, node : AST::Identifier)
#
For an Identifier, resolve it to any known local or type if possible.
For a FieldRead, FieldWrite, or FieldDisplace; take note of it by name.
For a call node, defer the normal visit order, so that we can visit the receiver, identifier, and args in the normal order, but visit the yield params and yield block in a special sub-visitor.