Class: RBS::Inline::AST::Annotations::SpecialVarTypeAnnotation
- Defined in:
- lib/rbs/inline/ast/annotations.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
: String?.
-
#name ⇒ Object
readonly
: Symbol?.
-
#type ⇒ Object
readonly
: Types::t?.
-
#type_source ⇒ Object
readonly
: String.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(tree, source) ⇒ SpecialVarTypeAnnotation
constructor
A new instance of SpecialVarTypeAnnotation.
Constructor Details
#initialize(tree, source) ⇒ SpecialVarTypeAnnotation
Returns a new instance of SpecialVarTypeAnnotation.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/rbs/inline/ast/annotations.rb', line 170 def initialize(tree, source) @tree = tree @source = source annotation = tree.nth_tree!(1) if name = annotation.nth_token?(1) @name = name[1].to_sym end if type = annotation.nth_type?(3) @type = type @type_source = type.location&.source || raise else @type = nil @type_source = annotation.nth_tree!(3)&.to_s || raise end if comment = annotation.nth_tree(4) @comment = comment.to_s end end |
Instance Attribute Details
#comment ⇒ Object (readonly)
: String?
165 166 167 |
# File 'lib/rbs/inline/ast/annotations.rb', line 165 def comment @comment end |
#name ⇒ Object (readonly)
: Symbol?
161 162 163 |
# File 'lib/rbs/inline/ast/annotations.rb', line 161 def name @name end |
#type ⇒ Object (readonly)
: Types::t?
163 164 165 |
# File 'lib/rbs/inline/ast/annotations.rb', line 163 def type @type end |
#type_source ⇒ Object (readonly)
: String
167 168 169 |
# File 'lib/rbs/inline/ast/annotations.rb', line 167 def type_source @type_source end |