Class: Stone::AST::TypeAnnotation
- Inherits:
-
Stone::AST
- Object
- Stone::AST
- Stone::AST::TypeAnnotation
- Defined in:
- lib/stone/ast/type_annotation.rb
Instance Attribute Summary collapse
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Attributes inherited from Stone::AST
Instance Method Summary collapse
-
#initialize(type_name) ⇒ TypeAnnotation
constructor
A new instance of TypeAnnotation.
- #to_s ⇒ Object
-
#to_type(registry) ⇒ Object
Convert to Stone::Type for type checking.
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_name ⇒ Object (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_s ⇒ Object
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 |