Class: MilkTea::Types::Dyn
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#interface_binding ⇒ Object
readonly
Returns the value of attribute interface_binding.
-
#type_arguments ⇒ Object
readonly
Returns the value of attribute type_arguments.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #field(name) ⇒ Object
-
#initialize(interface_binding, type_arguments = []) ⇒ Dyn
constructor
A new instance of Dyn.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(interface_binding, type_arguments = []) ⇒ Dyn
Returns a new instance of Dyn.
1651 1652 1653 1654 1655 1656 |
# File 'lib/milk_tea/core/types/types.rb', line 1651 def initialize(interface_binding, type_arguments = []) @interface_binding = interface_binding @type_arguments = type_arguments @hash = [self.class, interface_binding, type_arguments].hash freeze end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1664 1665 1666 |
# File 'lib/milk_tea/core/types/types.rb', line 1664 def hash @hash end |
#interface_binding ⇒ Object (readonly)
Returns the value of attribute interface_binding.
1649 1650 1651 |
# File 'lib/milk_tea/core/types/types.rb', line 1649 def interface_binding @interface_binding end |
#type_arguments ⇒ Object (readonly)
Returns the value of attribute type_arguments.
1649 1650 1651 |
# File 'lib/milk_tea/core/types/types.rb', line 1649 def type_arguments @type_arguments end |
Instance Method Details
#children ⇒ Object
1679 1680 1681 |
# File 'lib/milk_tea/core/types/types.rb', line 1679 def children type_arguments end |
#eql?(other) ⇒ Boolean Also known as: ==
1658 1659 1660 |
# File 'lib/milk_tea/core/types/types.rb', line 1658 def eql?(other) other.is_a?(Dyn) && other.interface_binding == interface_binding && other.type_arguments == type_arguments end |
#field(name) ⇒ Object
1674 1675 1676 1677 |
# File 'lib/milk_tea/core/types/types.rb', line 1674 def field(name) void_ptr = GenericInstance.new("ptr", [Primitive.new("void")]) { "data" => void_ptr, "vtable" => void_ptr }[name] end |
#to_s ⇒ Object
1666 1667 1668 1669 1670 1671 1672 |
# File 'lib/milk_tea/core/types/types.rb', line 1666 def to_s if type_arguments.any? "dyn[#{interface_binding.name}[#{type_arguments.map(&:to_s).join(', ')}]]" else "dyn[#{interface_binding.name}]" end end |