Class: RBS::Inline::AST::Declarations::ClassDecl
Overview
Instance Attribute Summary collapse
#comments, #members, #node
Instance Method Summary
collapse
#type_name, #value_node
#start_line, #type_params
Constructor Details
#initialize(node, comments, super_app) ⇒ ClassDecl
103
104
105
106
107
|
# File 'lib/rbs/inline/ast/declarations.rb', line 103
def initialize(node, , super_app)
super(node, )
@super_app = super_app
end
|
Instance Attribute Details
#super_app ⇒ Object
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
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
if
if inherits = .each_annotation.find {|a| a.is_a?(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
super_args = nil
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
|