Class: RBS::Inline::AST::Declarations::ClassDecl
- Inherits:
-
ModuleOrClass
- Object
- Base
- ModuleOrClass
- RBS::Inline::AST::Declarations::ClassDecl
- Includes:
- ConstantUtil
- Defined in:
- lib/rbs/inline/ast/declarations.rb
Overview
- Prism::ClassNode
Instance Attribute Summary collapse
-
#super_app ⇒ Object
readonly
Type application for super class.
Attributes inherited from ModuleOrClass
Instance Method Summary collapse
- #class_name ⇒ Object
-
#initialize(node, comments, super_app) ⇒ ClassDecl
constructor
A new instance of ClassDecl.
- #super_class ⇒ Object
Methods included from ConstantUtil
Methods inherited from ModuleOrClass
Constructor Details
#initialize(node, comments, super_app) ⇒ ClassDecl
Returns a new instance of ClassDecl.
103 104 105 106 107 |
# File 'lib/rbs/inline/ast/declarations.rb', line 103 def initialize(node, comments, super_app) super(node, comments) @super_app = super_app end |
Instance Attribute Details
#super_app ⇒ Object (readonly)
Type application for super class
97 98 99 |
# File 'lib/rbs/inline/ast/declarations.rb', line 97 def super_app @super_app end |
Instance Method Details
#class_name ⇒ Object
110 111 112 |
# File 'lib/rbs/inline/ast/declarations.rb', line 110 def class_name #: TypeName? type_name(node.constant_path) end |
#super_class ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/rbs/inline/ast/declarations.rb', line 115 def super_class #: RBS::AST::Declarations::Class::Super? if comments if inherits = comments.each_annotation.find {|a| a.is_a?(Annotations::Inherits) } #: Annotations::Inherits? super_name = inherits.super_name super_args = inherits.args if super_name && super_args return RBS::AST::Declarations::Class::Super.new( name: super_name, args: super_args, location: nil ) end end end if node.superclass super_name = nil #: TypeName? super_args = nil #: Array[Types::t]? if super_app super_args = super_app.types end super_name = type_name(node.superclass) if super_name return RBS::AST::Declarations::Class::Super.new( name: super_name, args: super_args || [], location: nil ) end end end |