Class: MilkTea::Types::StructInstance
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
Attributes inherited from Struct
#alignment, #ast_declaration, #external, #lifetime_params, #linkage_name, #module_name, #name, #nested_types, #packed
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(definition, arguments) ⇒ StructInstance
constructor
A new instance of StructInstance.
- #to_s ⇒ Object
Methods inherited from Struct
#define_events, #define_fields, #define_nested_types, #event, #events, #field, #field_c_name, #fields, #has_events?, #set_layout
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(definition, arguments) ⇒ StructInstance
Returns a new instance of StructInstance.
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/milk_tea/core/types/types.rb', line 998 def initialize(definition, arguments) super( definition.name, module_name: definition.module_name, external: definition.external, packed: definition.packed, alignment: definition.alignment, linkage_name: definition.linkage_name, lifetime_params: definition.lifetime_params, ) @definition = definition @arguments = arguments.freeze @nested_types = definition.respond_to?(:nested_types) ? definition.nested_types.dup : {} end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
996 997 998 |
# File 'lib/milk_tea/core/types/types.rb', line 996 def arguments @arguments end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
996 997 998 |
# File 'lib/milk_tea/core/types/types.rb', line 996 def definition @definition end |
Instance Method Details
#children ⇒ Object
1028 1029 1030 |
# File 'lib/milk_tea/core/types/types.rb', line 1028 def children fields.values end |
#eql?(other) ⇒ Boolean Also known as: ==
1013 1014 1015 |
# File 'lib/milk_tea/core/types/types.rb', line 1013 def eql?(other) other.is_a?(StructInstance) && other.definition == definition && other.arguments == arguments end |
#hash ⇒ Object
1019 1020 1021 |
# File 'lib/milk_tea/core/types/types.rb', line 1019 def hash [self.class, definition, arguments].hash end |
#to_s ⇒ Object
1023 1024 1025 1026 |
# File 'lib/milk_tea/core/types/types.rb', line 1023 def to_s base = module_name ? "#{module_name}.#{name}" : name "#{base}[#{arguments.join(', ')}]" end |