abstract class Crystal::SemanticVisitor
inherits Crystal::Visitor
¶
Base visitor for semantic analysis. It traverses the whole
ASTNode tree, keeping a current_type
in context, which corresponds
to the type being visited according to class/module/lib definitions.
Direct known subclasses
Crystal::ClassVarsInitializerVisitor
Crystal::InstanceVarsInitializerVisitor
Crystal::MainVisitor
Crystal::TopLevelVisitor
Crystal::TypeDeclarationVisitor
Crystal::TypeGuessVisitor
Class methods¶
Methods¶
#current_type : ModuleType
¶
: ModuleType
At every point there's a current type.
In the beginning this is the Program
(top-level), but when
a class definition is visited this changes to that type, and so on.
#current_type=(current_type : ModuleType)
¶
(current_type : ModuleType)
At every point there's a current type.
In the beginning this is the Program
(top-level), but when
a class definition is visited this changes to that type, and so on.
#lookup_type(node : ASTNode, free_vars = nil, find_root_generic_type_parameters = true)
¶
(node : ASTNode, free_vars = nil, find_root_generic_type_parameters = true)
#read_annotations
¶
Returns the current annotations and clears them for subsequent readers.
#visit(node : Require)
¶
(node : Require)
Transform require to its source code. The source code can be a Nop if the file was already required.
#visit(node : ExternalVar | Path | Generic | ProcNotation | Union | Metaclass | Self | TypeOf)
¶
(node : ExternalVar | Path | Generic | ProcNotation | Union | Metaclass | Self | TypeOf)