Skip to content

class Crystal::TypeDeclarationProcessor::InstanceVarTypeInfo
inherits Reference

The types we guess for instance types can be nodes or types. In the case of a generic type we might have:

class Foo(T)
  def foo
    @x = T.new
  end

  def foo
    @x = 1
  end
end

In the above case we know @x is of type T (but we don't know what T is when instantiated) and Int32 (we know that type). So we keep a list of all types and nodes, and we eventually resolve them all when a generic type is instantiated.

Class methods

.new(location : Location, type : Type)

View source

Methods

#add_annotations(anns : Array(Tuple(AnnotationType, Annotation))?)

View source

#annotations=(annotations : Array(Tuple(AnnotationType, Annotation))?)

View source

#outside_def : Bool

View source

#outside_def=(outside_def)

View source

#type : Type

View source

#type=(type : Type)

View source