class RBS::Prototype::Runtime::Todo

Public Class Methods

new(builder:) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 11
def initialize(builder:)
  @builder = builder
end

Public Instance Methods

skip_constant?(module_name:, name:) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 42
def skip_constant?(module_name:, name:)
  namespace = Namespace.new(path: module_name.split('::').map(&:to_sym), absolute: true)
  @builder.env.constant_decl?(TypeName.new(namespace: namespace, name: name))
end
skip_instance_method?(module_name:, method:, accessibility:) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 33
def skip_instance_method?(module_name:, method:, accessibility:)
  return false unless @builder.env.module_class_entry(module_name.absolute!)

  method_definition = @builder.build_instance(module_name.absolute!).methods[method.name]
  return false unless method_definition

  method_definition.accessibility == accessibility
end
skip_mixin?(type_name:, module_name:, mixin_class:) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 15
def skip_mixin?(type_name:, module_name:, mixin_class:)
  return false unless @builder.env.module_class_entry(type_name.absolute!)
  return false unless @builder.env.module_class_entry(module_name.absolute!)

  mixin_decls(type_name).any? do |decl|
    decl.instance_of?(mixin_class) && decl.name == module_name.absolute!
  end
end
skip_singleton_method?(module_name:, method:, accessibility:) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 24
def skip_singleton_method?(module_name:, method:, accessibility:)
  return false unless @builder.env.module_class_entry(module_name.absolute!)

  method_definition = @builder.build_singleton(module_name.absolute!).methods[method.name]
  return false unless method_definition

  method_definition.accessibility == accessibility
end

Private Instance Methods

mixin_decls(type_name) click to toggle source
# File rbs-3.4.4/lib/rbs/prototype/runtime.rb, line 49
def mixin_decls(type_name)
  type_name_absolute = type_name.absolute!
  (@mixin_decls_cache ||= {}).fetch(type_name_absolute) do
    @mixin_decls_cache[type_name_absolute] = @builder.env.class_decls[type_name_absolute].decls.flat_map do |d|
      d.decl.members.select { |m| m.kind_of?(AST::Members::Mixin) }
    end
  end
end