Class: RDL::Type::TopType

Inherits:
RDL::Type show all
Defined in:
lib/rdl/types/top.rb

Constant Summary collapse

@@cache =
nil

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RDL::Type

expand_product

Constructor Details

#initializeTopType

Returns a new instance of TopType.



14
15
16
# File 'lib/rdl/types/top.rb', line 14

def initialize
  super
end

Class Method Details

.__new__Object



6
# File 'lib/rdl/types/top.rb', line 6

alias :__new__ :new

.newObject



9
10
11
12
# File 'lib/rdl/types/top.rb', line 9

def self.new
  @@cache = TopType.__new__ unless @@cache
  return @@cache
end

Instance Method Details

#<=(other) ⇒ Object



37
38
39
# File 'lib/rdl/types/top.rb', line 37

def <=(other)
  return Type.leq(self, other)
end

#==(other) ⇒ Object Also known as: eql?



22
23
24
25
26
# File 'lib/rdl/types/top.rb', line 22

def ==(other)
  return false if other.nil?
  other = other.canonical
  other.instance_of? TopType
end

#copyObject



55
56
57
# File 'lib/rdl/types/top.rb', line 55

def copy
  return self
end

#hashObject



59
60
61
# File 'lib/rdl/types/top.rb', line 59

def hash
  17
end

#instantiate(inst) ⇒ Object



47
48
49
# File 'lib/rdl/types/top.rb', line 47

def instantiate(inst)
  return self
end

#match(other) ⇒ Object



30
31
32
33
34
35
# File 'lib/rdl/types/top.rb', line 30

def match(other)
  other = other.canonical
  other = other.type if other.instance_of? AnnotatedArgType
  return true if other.instance_of? WildQuery
  return self == other
end

#member?(obj, *args) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
45
# File 'lib/rdl/types/top.rb', line 41

def member?(obj, *args)
  t = RDL::Util.rdl_type obj
  return t <= self if t
  true
end

#to_sObject



18
19
20
# File 'lib/rdl/types/top.rb', line 18

def to_s
  "%any"
end

#widenObject



51
52
53
# File 'lib/rdl/types/top.rb', line 51

def widen
  return self
end