Class: MilkTea::Types::FieldHandle

Inherits:
Base
  • Object
show all
Defined in:
lib/milk_tea/core/types/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#accept, #bitwise?, #boolean?, #children, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?

Constructor Details

#initialize(struct_handle, field_name, field_declaration) ⇒ FieldHandle

Returns a new instance of FieldHandle.



278
279
280
281
282
283
284
# File 'lib/milk_tea/core/types/types.rb', line 278

def initialize(struct_handle, field_name, field_declaration)
  @struct_handle = struct_handle
  @field_name = field_name
  @field_declaration = field_declaration
  @hash = [self.class, struct_handle, field_name].hash
  freeze
end

Instance Attribute Details

#field_declarationObject (readonly)

Returns the value of attribute field_declaration.



276
277
278
# File 'lib/milk_tea/core/types/types.rb', line 276

def field_declaration
  @field_declaration
end

#field_nameObject (readonly)

Returns the value of attribute field_name.



276
277
278
# File 'lib/milk_tea/core/types/types.rb', line 276

def field_name
  @field_name
end

#hashObject (readonly)

Returns the value of attribute hash.



292
293
294
# File 'lib/milk_tea/core/types/types.rb', line 292

def hash
  @hash
end

#struct_handleObject (readonly)

Returns the value of attribute struct_handle.



276
277
278
# File 'lib/milk_tea/core/types/types.rb', line 276

def struct_handle
  @struct_handle
end

Instance Method Details

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

Returns:

  • (Boolean)


286
287
288
# File 'lib/milk_tea/core/types/types.rb', line 286

def eql?(other)
  other.is_a?(FieldHandle) && other.struct_handle == struct_handle && other.field_name == field_name
end

#to_sObject



295
296
297
# File 'lib/milk_tea/core/types/types.rb', line 295

def to_s
  "field_of(#{struct_handle.struct_type}, #{field_name})"
end