Class: Stone::AST::TypeAnnotation

Inherits:
Stone::AST show all
Defined in:
lib/stone/ast/type_annotation.rb

Instance Attribute Summary collapse

Attributes inherited from Stone::AST

#children, #name

Instance Method Summary collapse

Constructor Details

#initialize(type_name) ⇒ TypeAnnotation



10
11
12
13
# File 'lib/stone/ast/type_annotation.rb', line 10

def initialize(type_name)
  @type_name = type_name
  @name = :type_annotation
end

Instance Attribute Details

#type_nameObject (readonly)

Returns the value of attribute type_name.



8
9
10
# File 'lib/stone/ast/type_annotation.rb', line 8

def type_name
  @type_name
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/stone/ast/type_annotation.rb', line 15

def to_s
  type_name
end

#to_type(registry) ⇒ Object

Convert to Stone::Type for type checking



20
21
22
# File 'lib/stone/ast/type_annotation.rb', line 20

def to_type(registry)
  registry.lookup(type_name)
end