Skip to content

class Crystal::ClassVarsInitializerVisitor
inherits Crystal::SemanticVisitor

In this pass we gather class var initializers like:

class Foo
  @@x = 1
end

The last initializer set for a type is the one that will be used.

Class variables don't have access to outside local variables. This won't compile:

class Foo
  a = 1
  @@x = a # ERROR
end

Class methods

.new(mod)

View source

Methods

#type_class_var(target, node, value)

View source

#visit(node : Assign)

View source

#visit(node : TypeDeclaration)

View source

#visit_any(node)

View source