class TypeProf::Type::HashGenerator

Attributes

map_tys[R]

Public Class Methods

new() click to toggle source
# File typeprof-0.21.3/lib/typeprof/type.rb, line 726
def initialize
  @map_tys = {}
end

Public Instance Methods

[]=(k_ty, v_ty) click to toggle source
# File typeprof-0.21.3/lib/typeprof/type.rb, line 732
def []=(k_ty, v_ty)
  k_ty.each_child_global do |k_ty|
    # This is a temporal hack to mitigate type explosion
    k_ty = Type.any if k_ty.is_a?(Type::Array)
    k_ty = Type.any if k_ty.is_a?(Type::Hash)

    if @map_tys[k_ty]
      @map_tys[k_ty] = @map_tys[k_ty].union(v_ty)
    else
      @map_tys[k_ty] = v_ty
    end
  end
end