In Files

  • rbs-1.0.4/lib/rbs/environment.rb

Class/Module Index [+]

Quicksearch

RBS::Environment::MultiEntry

Constants

D

Attributes

decls[R]
name[R]

Public Class Methods

new(name:) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/environment.rb, line 31
def initialize(name))
  @name = name
  @decls = []
end
            

Public Instance Methods

insert(decl:, outer:) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/environment.rb, line 36
def insert(decl,, outer))
  decls << D.new(decl: decl, outer: outer)
  @primary = nil
end
            
primary() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/environment.rb, line 63
def primary
  raise "Not implemented"
end
            
type_params() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/environment.rb, line 59
def type_params
  primary.decl.type_params
end
            
validate_type_params() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/environment.rb, line 41
def validate_type_params
  unless decls.empty?
    hd_decl, *tl_decls = decls
    raise unless hd_decl

    hd_params = hd_decl.decl.type_params
    hd_names = hd_params.params.map(&:name)

    tl_decls.each do |tl_decl|
      tl_params = tl_decl.decl.type_params

      unless hd_params.size == tl_params.size && hd_params == tl_params.rename_to(hd_names)
        raise GenericParameterMismatchError.new(name: name, decl: tl_decl.decl)
      end
    end
  end
end