Class: RBS::Types::UntypedFunction
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rbs/types.rb |
Class Method Summary
- .new(return_type:) ⇒ UntypedFunction constructor
Instance Attribute Summary
- #empty? ⇒ Boolean readonly
- #has_classish_type? ⇒ Boolean readonly
- #has_self_type? ⇒ Boolean readonly
- #return_type readonly
- #with_nonreturn_void? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(return_type:) ⇒ UntypedFunction
# File 'lib/rbs/types.rb', line 1215
def initialize(return_type:) @return_type = return_type end
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1271
def empty? true end
#has_classish_type? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1279
def has_classish_type? return_type.has_classish_type? end
#has_self_type? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1275
def has_self_type? return_type.has_self_type? end
#return_type (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 1213
attr_reader :return_type
#with_nonreturn_void? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1283
def with_nonreturn_void? false end
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]# File 'lib/rbs/types.rb', line 1295
def ==(other) other.is_a?(UntypedFunction) && other.return_type == return_type end
#each_param(&block)
[ GitHub ]# File 'lib/rbs/types.rb', line 1245
def each_param(&block) if block # noop else enum_for :each_param end end
#each_type(&block)
[ GitHub ]# File 'lib/rbs/types.rb', line 1237
def each_type(&block) if block yield return_type else enum_for :each_type end end
#eql?(other)
[ GitHub ]# File 'lib/rbs/types.rb', line 1299
alias eql? ==
#free_variables(acc = Set.new)
[ GitHub ]# File 'lib/rbs/types.rb', line 1219
def free_variables(acc = Set.new) return_type.free_variables(acc) end
#hash
[ GitHub ]# File 'lib/rbs/types.rb', line 1301
def hash self.class.hash ^ return_type.hash end
#map_type(&block)
[ GitHub ]# File 'lib/rbs/types.rb', line 1223
def map_type(&block) if block update(return_type: yield(return_type)) else enum_for :map_type end end
#map_type_name(&block)
[ GitHub ]# File 'lib/rbs/types.rb', line 1231
def map_type_name(&block) UntypedFunction.new( return_type: return_type.map_type_name(&block) ) end
#param_to_s
[ GitHub ]# File 'lib/rbs/types.rb', line 1287
def param_to_s "?" end
#return_to_s
[ GitHub ]# File 'lib/rbs/types.rb', line 1291
def return_to_s return_type.to_s(1) end
#sub(subst)
[ GitHub ]# File 'lib/rbs/types.rb', line 1259
def sub(subst) map_type { _1.sub(subst) } end
#to_json(state = _ = nil)
[ GitHub ]# File 'lib/rbs/types.rb', line 1253
def to_json(state = _ = nil) { return_type: return_type }.to_json(state) end
#update(return_type: self.return_type)
[ GitHub ]# File 'lib/rbs/types.rb', line 1267
def update(return_type: self.return_type) UntypedFunction.new(return_type: return_type) end
#with_return_type(ty)
[ GitHub ]# File 'lib/rbs/types.rb', line 1263
def with_return_type(ty) update(return_type: ty) end