class Crystal::TypeDeclarationVisitor
inherits Crystal::SemanticVisitor
¶
In this pass we check type declarations like:
@x : Int32
@@x : Int32
$x : Int32
In this way we declare their type before the "main" code.
This allows to put "main" code before these declarations, so order matters less in the end.
This visitor also processes the following:
- C struct/union fields
- fun declarations
- alias declarations
We do this now because in a previous pass, TopLevelVisitor declared all types so now we can search them and always find them, not needing any kind of forward referencing.
Class methods¶
Methods¶
#class_vars : Hash(Crystal::ClassVarContainer, Hash(String, Crystal::TypeDeclarationProcessor::TypeDeclarationWithLocation))
¶
: Hash(Crystal::ClassVarContainer, Hash(String, Crystal::TypeDeclarationProcessor::TypeDeclarationWithLocation))
#instance_vars : Hash(Crystal::Type, Hash(String, Crystal::TypeDeclarationProcessor::TypeDeclarationWithLocation))
¶
: Hash(Crystal::Type, Hash(String, Crystal::TypeDeclarationProcessor::TypeDeclarationWithLocation))