class
Crystal::MetaTypeVar
Overview
A variable belonging to a type: a global, class or instance variable (globals belong to the program).
Included Modules
Defined in:
compiler/crystal/semantic/ast.crInstance Method Summary
- #freeze_type : Type | Nil
- #freeze_type=(freeze_type : Type | Nil)
- #global?
-
#initializer : ClassVarInitializer | Nil
The (optional) initial value of a class variable
-
#initializer=(initializer : ClassVarInitializer | Nil)
The (optional) initial value of a class variable
- #kind
- #nil_reason : NilReason | Nil
- #nil_reason=(nil_reason : NilReason | Nil)
-
#no_init_flag=(no_init_flag : Bool)
If true, there's no need to check whether the class var was initialized or not when reading it.
-
#no_init_flag? : Bool
If true, there's no need to check whether the class var was initialized or not when reading it.
-
#owner : Type
The owner of this variable, useful for showing good error messages.
-
#owner=(owner : Type)
The owner of this variable, useful for showing good error messages.
-
#owner? : Type | Nil
The owner of this variable, useful for showing good error messages.
-
#read=(read : Bool)
Was this class_var already read during the codegen phase? If not, and we are at the place that declares the class var, we can directly initialize it now, without checking for an
initflag. -
#read? : Bool
Was this class_var already read during the codegen phase? If not, and we are at the place that declares the class var, we can directly initialize it now, without checking for an
initflag. -
#simple_initializer=(simple_initializer : Bool)
Flag used during codegen to indicate the initializer is simple and doesn't require a call to a function
-
#simple_initializer? : Bool
Flag used during codegen to indicate the initializer is simple and doesn't require a call to a function
-
#thread_local=(thread_local : Bool)
Is this variable thread local? Only applicable to global and class variables.
-
#thread_local? : Bool
Is this variable thread local? Only applicable to global and class variables.
-
#uninitialized=(uninitialized : Bool)
Is this variable "unsafe" (no need to check if it was initialized)?
-
#uninitialized? : Bool
Is this variable "unsafe" (no need to check if it was initialized)?
Instance methods inherited from module Crystal::Annotatable
add_annotation(annotation_type : AnnotationType, value : Annotation)
add_annotation,
all_annotations : Array(Annotation) | Nil
all_annotations,
annotation(annotation_type : AnnotationType) : Annotation | Nil
annotation,
annotations(annotation_type : AnnotationType) : Array(Annotation) | Nilannotations : Hash(AnnotationType, Array(Annotation)) | Nil annotations, annotations=(annotations : Hash(AnnotationType, Array(Annotation)) | Nil) annotations=
Instance methods inherited from class Crystal::Var
==(other : self)
==,
clone_without_location
clone_without_location,
doc : String | Nil
doc,
doc=(doc : String | Nil)
doc=,
hash(hasher)
hash,
name : String
name,
name=(name : String)
name=,
name_size
name_size,
pretty_print(pp) : Nil
pretty_print,
to_macro_id : String
to_macro_id
Constructor methods inherited from class Crystal::Var
new(name : String, type : Type)new(name : String) new
Instance methods inherited from module Crystal::SpecialVar
special_var?
special_var?
Instance methods inherited from class Crystal::ASTNode
accept(visitor)
accept,
accept_children(visitor)
accept_children,
add_observer(observer)
add_observer,
at(node : ASTNode)at(location : Location | Nil) at, at_end(node : ASTNode)
at_end(end_location : Location | Nil) at_end, bind(from = nil, &) bind, bind_to(node : ASTNode) : Nil
bind_to(nodes : Indexable) : Nil bind_to, class_desc class_desc, class_name class_name, clone clone, dependencies : SmallNodeList dependencies, doc doc, doc=(doc) doc=, enclosing_call : Call | Nil enclosing_call, enclosing_call=(enclosing_call : Call | Nil) enclosing_call=, end_location : Location | Nil end_location, end_location=(end_location : Location | Nil) end_location=, false_literal? false_literal?, filtered_by(filter) filtered_by, find_owner_trace(program, owner) find_owner_trace, freeze_type freeze_type, inspect(io : IO) : Nil inspect, interpret(method : String, args : Array(ASTNode), named_args : Hash(String, ASTNode) | Nil, block : Crystal::Block | Nil, interpreter : Crystal::MacroInterpreter, name_loc : Location | Nil) interpret, interpret_compare(other) interpret_compare, length : Int32 | Nil length, location : Location | Nil location, location=(location : Location | Nil) location=, macro_is_a?(macro_type : MacroType) : Bool macro_is_a?, map_type(type) map_type, name_location name_location, name_size name_size, no_returns? no_returns?, nop? nop?, notify_observers notify_observers, pretty_print(pp) pretty_print, propagate propagate, raise(message, inner = nil, exception_type = Crystal::TypeException) raise, raise_frozen_type(freeze_type, invalid_type, from) raise_frozen_type, remove_enclosing_call(enclosing_call) remove_enclosing_call, remove_observer(observer) remove_observer, restrict_type_to_freeze_type(freeze_type, type) restrict_type_to_freeze_type, restriction_of?(other : Underscore, owner, self_free_vars = nil, other_free_vars = nil)
restriction_of?(other : ASTNode, owner, self_free_vars = nil, other_free_vars = nil)
restriction_of?(other : Type, owner, self_free_vars = nil, other_free_vars = nil)
restriction_of?(other, owner, self_free_vars = nil, other_free_vars = nil) restriction_of?, set_enclosing_call(enclosing_call) set_enclosing_call, set_type(type : Type)
set_type(type : Nil) set_type, set_type_from(type, from) set_type_from, simple_literal? simple_literal?, single_expression single_expression, single_expression? single_expression?, stringify stringify, supports_autocast?(number_autocast : Bool = true) supports_autocast?, symbolize symbolize, to_macro_id to_macro_id, to_s(io : IO, macro_expansion_pragmas = nil, emit_doc = false, emit_location_pragmas : Bool = false) : Nil to_s, to_string(context) to_string, transform(transformer) transform, true_literal? true_literal?, truthy? truthy?, type
type(*, with_autocast = false) type, type=(type) type=, type? type?, type_from_dependencies : Type | Nil type_from_dependencies, unbind_from(nodes : Nil)
unbind_from(node : ASTNode)
unbind_from(nodes : Enumerable(ASTNode)) unbind_from, update(from = nil) update, visibility visibility, visibility=(visibility : Visibility) visibility=, warning(message, inner = nil, exception_type = Crystal::TypeException) warning, wrong_number_of(elements, subject, given, expected)
wrong_number_of(elements, given, expected) wrong_number_of, wrong_number_of_arguments(subject, given, expected) wrong_number_of_arguments, wrong_number_of_message(elements, subject, given, expected)
wrong_number_of_message(elements, given, expected) wrong_number_of_message
Class methods inherited from class Crystal::ASTNode
class_desc : String
class_desc
Instance methods inherited from class Reference
==(other : self)==(other : JSON::Any)
==(other : YAML::Any)
==(other) ==, dup dup, hash(hasher) hash, initialize initialize, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference) : Bool
same?(other : Nil) same?, to_s(io : IO) : Nil to_s
Constructor methods inherited from class Reference
new
new,
unsafe_construct(address : Pointer, *args, **opts) : self
unsafe_construct
Class methods inherited from class Reference
pre_initialize(address : Pointer)
pre_initialize
Instance methods inherited from class Object
! : Bool
!,
!=(other)
!=,
!~(other)
!~,
==(other)
==,
===(other : JSON::Any)===(other : YAML::Any)
===(other) ===, =~(other) =~, as(type : Class) as, as?(type : Class) as?, class class, dup dup, hash(hasher)
hash hash, in?(collection : Object) : Bool
in?(*values : Object) : Bool in?, inspect(io : IO) : Nil
inspect : String inspect, is_a?(type : Class) : Bool is_a?, itself itself, nil? : Bool nil?, not_nil!(message)
not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, responds_to?(name : Symbol) : Bool responds_to?, tap(&) tap, to_json(io : IO) : Nil
to_json : String to_json, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil to_pretty_json, to_s(io : IO) : Nil
to_s : String to_s, to_yaml(io : IO) : Nil
to_yaml : String to_yaml, try(&) try, unsafe_as(type : T.class) forall T unsafe_as
Class methods inherited from class Object
from_json(string_or_io : String | IO, root : String)from_json(string_or_io : String | IO) from_json, from_yaml(string_or_io : String | IO) from_yaml
Macros inherited from class Object
class_getter(*names, &block)
class_getter,
class_getter!(*names)
class_getter!,
class_getter?(*names, &block)
class_getter?,
class_property(*names, &block)
class_property,
class_property!(*names)
class_property!,
class_property?(*names, &block)
class_property?,
class_setter(*names)
class_setter,
def_clone
def_clone,
def_equals(*fields)
def_equals,
def_equals_and_hash(*fields)
def_equals_and_hash,
def_hash(*fields)
def_hash,
delegate(*methods, to object)
delegate,
forward_missing_to(delegate)
forward_missing_to,
getter(*names, &block)
getter,
getter!(*names)
getter!,
getter?(*names, &block)
getter?,
property(*names, &block)
property,
property!(*names)
property!,
property?(*names, &block)
property?,
setter(*names)
setter
Instance Method Detail
The (optional) initial value of a class variable
The (optional) initial value of a class variable
If true, there's no need to check whether the class var was initialized or not when reading it.
If true, there's no need to check whether the class var was initialized or not when reading it.
The owner of this variable, useful for showing good error messages.
The owner of this variable, useful for showing good error messages.
The owner of this variable, useful for showing good error messages.
Was this class_var already read during the codegen phase?
If not, and we are at the place that declares the class var, we can
directly initialize it now, without checking for an init flag.
Was this class_var already read during the codegen phase?
If not, and we are at the place that declares the class var, we can
directly initialize it now, without checking for an init flag.
Flag used during codegen to indicate the initializer is simple and doesn't require a call to a function
Flag used during codegen to indicate the initializer is simple and doesn't require a call to a function
Is this variable thread local? Only applicable to global and class variables.
Is this variable thread local? Only applicable to global and class variables.
Is this variable "unsafe" (no need to check if it was initialized)?
Is this variable "unsafe" (no need to check if it was initialized)?