Class: Stone::AST::TypeDeclaration
- Inherits:
-
Stone::AST
- Object
- Stone::AST
- Stone::AST::TypeDeclaration
- Defined in:
- lib/stone/ast/type_declaration.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#type_annotation ⇒ Object
readonly
Returns the value of attribute type_annotation.
Attributes inherited from Stone::AST
Instance Method Summary collapse
-
#initialize(identifier, type_annotation, location: nil) ⇒ TypeDeclaration
constructor
A new instance of TypeDeclaration.
- #to_s ⇒ Object
-
#type(_context = nil) ⇒ Object
Type declarations don't produce a value, so they have no type.
Constructor Details
#initialize(identifier, type_annotation, location: nil) ⇒ TypeDeclaration
Returns a new instance of TypeDeclaration.
10 11 12 13 14 15 |
# File 'lib/stone/ast/type_declaration.rb', line 10 def initialize(identifier, type_annotation, location: nil) @identifier = identifier @type_annotation = type_annotation @location = location @name = :type_declaration end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
8 9 10 |
# File 'lib/stone/ast/type_declaration.rb', line 8 def identifier @identifier end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
8 9 10 |
# File 'lib/stone/ast/type_declaration.rb', line 8 def location @location end |
#type_annotation ⇒ Object (readonly)
Returns the value of attribute type_annotation.
8 9 10 |
# File 'lib/stone/ast/type_declaration.rb', line 8 def type_annotation @type_annotation end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/stone/ast/type_declaration.rb', line 17 def to_s "#{identifier} :: #{type_annotation}" end |
#type(_context = nil) ⇒ Object
Type declarations don't produce a value, so they have no type
22 23 24 |
# File 'lib/stone/ast/type_declaration.rb', line 22 def type(_context = nil) nil end |