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.



658
659
660
# File 'lib/llvm/core/value.rb', line 658

def initialize(fun)
  @fun = fun
end

Instance Method Details

#[](i) ⇒ Object

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



663
664
665
# File 'lib/llvm/core/value.rb', line 663

def [](i)
  Value.from_ptr(C.LLVMGetParam(@fun, i))
end

#eachObject

Iteraters through each parameter in the collection.



675
676
677
678
679
# File 'lib/llvm/core/value.rb', line 675

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.



668
669
670
# File 'lib/llvm/core/value.rb', line 668

def size
  C.LLVMCountParams(@fun)
end