Class: LLVM::Function::ParameterCollection
- Inherits:
-
Object
- Object
- LLVM::Function::ParameterCollection
- Includes:
- Enumerable
- Defined in:
- lib/llvm/core/value.rb
Instance Method Summary collapse
-
#[](i) ⇒ Object
Returns a Value representation of the parameter at the given index.
-
#each ⇒ Object
Iteraters through each parameter in the collection.
-
#initialize(fun) ⇒ ParameterCollection
constructor
A new instance of ParameterCollection.
-
#size ⇒ Object
Returns the number of paramters in the collection.
Constructor Details
#initialize(fun) ⇒ ParameterCollection
Returns a new instance of ParameterCollection.
667 668 669 |
# File 'lib/llvm/core/value.rb', line 667 def initialize(fun) @fun = fun end |
Instance Method Details
#[](i) ⇒ Object
Returns a Value representation of the parameter at the given index.
672 673 674 675 676 677 |
# File 'lib/llvm/core/value.rb', line 672 def [](i) sz = self.size i = sz + i if i < 0 return unless 0 <= i && i < sz Value.from_ptr(C.LLVMGetParam(@fun, i)) end |
#each ⇒ Object
Iteraters through each parameter in the collection.
687 688 689 690 691 |
# File 'lib/llvm/core/value.rb', line 687 def each return to_enum :each unless block_given? 0.upto(size-1) { |i| yield self[i] } self end |
#size ⇒ Object
Returns the number of paramters in the collection.
680 681 682 |
# File 'lib/llvm/core/value.rb', line 680 def size C.LLVMCountParams(@fun) end |