Class: LLVM::Function::ParameterCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/llvm/core/value.rb

Instance Method Summary collapse

Constructor Details

#initialize(fun) ⇒ ParameterCollection

Returns a new instance of ParameterCollection.



750
751
752
# File 'lib/llvm/core/value.rb', line 750

def initialize(fun)
  @fun = fun
end

Instance Method Details

#[](i) ⇒ Object

Returns a Value representation of the parameter at the given index.



755
756
757
758
759
760
# File 'lib/llvm/core/value.rb', line 755

def [](i)
  sz = self.size
  i = sz + i if i < 0
  return unless 0 <= i && i < sz
  Value.from_ptr(C.get_param(@fun, i))
end

#eachObject

Iteraters through each parameter in the collection.



770
771
772
773
774
# File 'lib/llvm/core/value.rb', line 770

def each
  return to_enum :each unless block_given?
  0.upto(size-1) { |i| yield self[i] }
  self
end

#sizeObject

Returns the number of paramters in the collection.



763
764
765
# File 'lib/llvm/core/value.rb', line 763

def size
  C.count_params(@fun)
end