Class: MilkTea::Types::SoA
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #field(name) ⇒ Object
- #fields ⇒ Object
-
#initialize(element_type, count:) ⇒ SoA
constructor
A new instance of SoA.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(element_type, count:) ⇒ SoA
Returns a new instance of SoA.
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/milk_tea/core/types/types.rb', line 1522 def initialize(element_type, count:) @name = "SoA[#{element_type}, #{count}]" @element_type = element_type @count = count @module_name = nil @fields = if element_type.respond_to?(:fields) && element_type.fields element_type.fields.each_with_object({}) do |(fname, ftype), h| h[fname] = GenericInstance.new("array", [ftype, LiteralTypeArg.new(count)]) end else {}.freeze end.freeze @hash = [self.class, element_type, count].hash freeze end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
1520 1521 1522 |
# File 'lib/milk_tea/core/types/types.rb', line 1520 def count @count end |
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
1520 1521 1522 |
# File 'lib/milk_tea/core/types/types.rb', line 1520 def element_type @element_type end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1544 1545 1546 |
# File 'lib/milk_tea/core/types/types.rb', line 1544 def hash @hash end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
1520 1521 1522 |
# File 'lib/milk_tea/core/types/types.rb', line 1520 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1520 1521 1522 |
# File 'lib/milk_tea/core/types/types.rb', line 1520 def name @name end |
Instance Method Details
#children ⇒ Object
1558 1559 1560 |
# File 'lib/milk_tea/core/types/types.rb', line 1558 def children [element_type] end |
#eql?(other) ⇒ Boolean Also known as: ==
1538 1539 1540 |
# File 'lib/milk_tea/core/types/types.rb', line 1538 def eql?(other) other.is_a?(SoA) && other.element_type == element_type && other.count == count end |
#field(name) ⇒ Object
1550 1551 1552 |
# File 'lib/milk_tea/core/types/types.rb', line 1550 def field(name) @fields[name] end |
#fields ⇒ Object
1546 1547 1548 |
# File 'lib/milk_tea/core/types/types.rb', line 1546 def fields @fields end |
#to_s ⇒ Object
1554 1555 1556 |
# File 'lib/milk_tea/core/types/types.rb', line 1554 def to_s @name end |