class RLTK::CG::ConstantAggregate
All constant aggregate values inherit from this class.
@abstract
Public Instance Methods
extract(*indices)
click to toggle source
Extract values from a constant aggregate value.
@param [Array<Value>] indices Array of values representing indices into the aggregate.
@return [ConstantExpr] Extracted values.
# File lib/rltk/cg/value.rb, line 380 def extract(*indices) indices_ptr = FFI::MemoryPointer.new(:uint, indices.length) indices_ptr.write_array_of_uint(indices) ConstantExpr.new(Bindings.const_extract_value(@ptr, indices_ptr, indices.length)) end
insert(value, indices)
click to toggle source
Insert values into a constant aggregate value.
@param [Value] value Value
to insert. @param [Array<Value>] indices Array of values representing indices into the aggregate.
@return [ConstantExpr] New aggregate representation with inserted values.
# File lib/rltk/cg/value.rb, line 393 def insert(value, indices) indices_ptr = FFI::MemoryPointer.new(:uint, indices.length) indices_ptr.write_array_of_uint(indices) ConstantExpr.new(Bindings.const_insert_value(@ptr, value, indices_ptr, inicies.length)) end