class Crystal::MetaVar
inherits Crystal::ASTNode
¶
Included modules
Crystal::SpecialVar
Class methods¶
Methods¶
#closure_in?(context)
¶
(context)
True if this variable belongs to the given context but must be allocated in a closure.
#closured? : Bool
¶
: Bool
A variable is closured if it's used in a ProcLiteral context where it wasn't created.
#context : ASTNode | NonGenericModuleType | Nil
¶
: ASTNode | NonGenericModuleType | Nil
This is the context of the variable: who allocates it. It can either be the Program (for top level variables), a Def or a Block.
#context=(context : ASTNode | NonGenericModuleType | Nil)
¶
(context : ASTNode | NonGenericModuleType | Nil)
This is the context of the variable: who allocates it. It can either be the Program (for top level variables), a Def or a Block.
#inspect(io : IO) : Nil
¶
(io : IO) : Nil
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
#local_vars
¶
Local variables associated with this meta variable. Can be Var or MetaVar.
#local_vars=(local_vars)
¶
(local_vars)
Local variables associated with this meta variable. Can be Var or MetaVar.
#local_vars? : Array(Crystal::ASTNode)?
¶
: Array(Crystal::ASTNode)?
Is this metavar associated with any local vars?
#mutably_closured=(mutably_closured)
¶
(mutably_closured)
Is this metavar closured in a mutable way? This means it's closured and it got a value assigned to it more than once. If that's the case, when it's closured then all local variable related to it will also be bound to it.
#mutably_closured? : Bool
¶
: Bool
Is this metavar closured in a mutable way? This means it's closured and it got a value assigned to it more than once. If that's the case, when it's closured then all local variable related to it will also be bound to it.
#nil_if_read=(nil_if_read)
¶
(nil_if_read)
True if we need to mark this variable as nilable if this variable is read.
#nil_if_read? : Bool
¶
: Bool
True if we need to mark this variable as nilable if this variable is read.