Module: RBS::Types::Application

Included in:
Alias, ClassInstance, Interface
Defined in:
lib/rbs/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



254
255
256
# File 'lib/rbs/types.rb', line 254

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



253
254
255
# File 'lib/rbs/types.rb', line 253

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



256
257
258
# File 'lib/rbs/types.rb', line 256

def ==(other)
  other.is_a?(self.class) && other.name == name && other.args == args
end

#each_type(&block) ⇒ Object



282
283
284
285
286
287
288
# File 'lib/rbs/types.rb', line 282

def each_type(&block)
  if block
    args.each(&block)
  else
    enum_for :each_type
  end
end

#free_variables(set = Set.new) ⇒ Object



266
267
268
269
270
271
272
# File 'lib/rbs/types.rb', line 266

def free_variables(set = Set.new)
  set.tap do
    args.each do |arg|
      arg.free_variables(set)
    end
  end
end

#has_classish_type?Boolean

Returns:

  • (Boolean)


294
295
296
# File 'lib/rbs/types.rb', line 294

def has_classish_type?
  each_type.any? {|type| type.has_classish_type? }
end

#has_self_type?Boolean

Returns:

  • (Boolean)


290
291
292
# File 'lib/rbs/types.rb', line 290

def has_self_type?
  each_type.any? {|type| type.has_self_type? }
end

#hashObject



262
263
264
# File 'lib/rbs/types.rb', line 262

def hash
  name.hash ^ args.hash
end

#to_s(level = 0) ⇒ Object



274
275
276
277
278
279
280
# File 'lib/rbs/types.rb', line 274

def to_s(level = 0)
  if args.empty?
    name.to_s
  else
    "#{name}[#{args.join(", ")}]"
  end
end

#with_nonreturn_void?Boolean

Returns:

  • (Boolean)


298
299
300
301
302
303
304
305
306
307
# File 'lib/rbs/types.rb', line 298

def with_nonreturn_void?
  each_type.any? do |type|
    if type.is_a?(Bases::Void)
      # `void` in immediate generics parameter is allowed
      false
    else
      type.with_nonreturn_void?
    end
  end
end