Class: RubyBreaker::TypeDefs::SelfType

Inherits:
NominalType show all
Defined in:
lib/rubybreaker/type/type.rb

Overview

This type represents the self type. Note that this is a subclass of Nominal Type. It works just like nominal type except that it also points to the current object! See subtyping.rb for more detail on how this would impact typing.

Instance Attribute Summary

Attributes inherited from NominalType

#mod

Attributes inherited from Type

#ctx

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#eql?, #subtype_of?, #unparse

Constructor Details

#initialize(*args) ⇒ SelfType

Returns a new instance of SelfType.



109
110
111
112
# File 'lib/rubybreaker/type/type.rb', line 109

def initialize(*args)
  # NOTE: @@mod is not required in general, but for typing it is a must.
  super(@@mod, *args)
end

Class Method Details

.get_self(mod) ⇒ Object

This is a getter method for class variable mod.



105
106
107
# File 'lib/rubybreaker/type/type.rb', line 105

def self.get_self(mod)
  @@mod = mod
end

.set_self(mod) ⇒ Object

This is a setter method for class variable mod. NOTE: It is set every time typesig() is called



100
101
102
# File 'lib/rubybreaker/type/type.rb', line 100

def self.set_self(mod)
  @@mod = mod
end