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.



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

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

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



258
259
260
# File 'lib/rbs/types.rb', line 258

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

#each_type(&block) ⇒ Object



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

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

#free_variables(set = Set.new) ⇒ Object



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

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)


296
297
298
# File 'lib/rbs/types.rb', line 296

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

#has_self_type?Boolean

Returns:

  • (Boolean)


292
293
294
# File 'lib/rbs/types.rb', line 292

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

#hashObject



264
265
266
# File 'lib/rbs/types.rb', line 264

def hash
  name.hash ^ args.hash
end

#to_s(level = 0) ⇒ Object



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

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

#with_nonreturn_void?Boolean

Returns:

  • (Boolean)


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

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