123456789_123456789_123456789_123456789_123456789_

Class: RBS::Prototype::Runtime::Todo

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/prototype/runtime.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(builder:) ⇒ Todo

[ GitHub ]

  
# File 'lib/rbs/prototype/runtime.rb', line 11

def initialize(builder:)
  @builder = builder
end

Instance Method Details

#mixin_decls(type_name) (private)

[ GitHub ]

  
# File '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

#skip_constant?(module_name:, name:) ⇒ Boolean

[ GitHub ]

  
# File '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:) ⇒ Boolean

[ GitHub ]

  
# File '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:) ⇒ Boolean

[ GitHub ]

  
# File '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:) ⇒ Boolean

[ GitHub ]

  
# File '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