123456789_123456789_123456789_123456789_123456789_

Class: TypeProf::Type::Var

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: TypeProf::Type
Defined in: lib/typeprof/type.rb

Constant Summary

::TypeProf::Type - Inherited

Builtin, DummySubstitution

Class Method Summary

Instance Method Summary

Constructor Details

.new(name) ⇒ Var

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 451

def initialize(name)
  @name = name
end

Instance Method Details

#add_subst!(ty, subst)

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 475

def add_subst!(ty, subst)
  if subst[self]
    subst[self] = subst[self].union(ty)
  else
    subst[self] = ty
  end
  true
end

#consistent?(_other) ⇒ Boolean

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 471

def consistent?(_other)
  raise "should not be called: #{ self }"
end

#each_free_type_variable {|_self| ... }

Yields:

  • (_self)

Yield Parameters:

  • _self (Var)

    the object that the method was called on

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 459

def each_free_type_variable
  yield self
end

#screen_name(scratch)

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 455

def screen_name(scratch)
  "Var[#{ @name }]"
end

#substitute(subst, depth)

[ GitHub ]

  
# File 'lib/typeprof/type.rb', line 463

def substitute(subst, depth)
  if subst[self]
    subst[self].limit_size(depth)
  else
    self
  end
end