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.



1169
1170
1171
# File 'lib/llvm/core/value.rb', line 1169

def initialize(fun)
  @fun = fun
end

Instance Method Details

#[](i) ⇒ Object

Returns a Value representation of the parameter at the given index. (Integer) -> Value?



1175
1176
1177
1178
1179
1180
# File 'lib/llvm/core/value.rb', line 1175

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

#eachObject

Iteraters through each parameter in the collection.



1191
1192
1193
1194
1195
# File 'lib/llvm/core/value.rb', line 1191

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. : -> Integer



1184
1185
1186
# File 'lib/llvm/core/value.rb', line 1184

def size
  C.count_params(@fun)
end