class TypeProf::Type::HashGenerator
Attributes
map_tys[R]
Public Class Methods
new()
click to toggle source
# File typeprof-0.21.11/lib/typeprof/type.rb, line 729 def initialize @map_tys = {} end
Public Instance Methods
[]=(k_ty, v_ty)
click to toggle source
# File typeprof-0.21.11/lib/typeprof/type.rb, line 735 def []=(k_ty, v_ty) k_ty.each_child_global do |k_ty| if k_ty.is_a?(Type::Union) # Flatten recursive union self[k_ty] = v_ty else # 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 end