{
if (bindingIndicesSet) {
return;
}
Bindings bindings = rule.getBindings();
Iterator<Binding> iterator = bindings.iterator();
List<Binding> aliasBindings = new ArrayList<Binding>();
int argLocalIndex = 0;
// if this is an instance method then the local 0 holds this and args start at local index 1
if ((access & Opcodes.ACC_STATIC) == 0) {
argLocalIndex += 1;
}
// compute the local indices of each method parameter
for (int i = 0; i < argumentTypes.length; i++) {
argLocalIndices[i] = argLocalIndex;
argLocalIndex += argumentTypes[i].getSize();
}
// check the local var bindings and, if any of them are actually refereces to method params
// alias them to the corresponding param binding
while (iterator.hasNext()) {
Binding binding = iterator.next();
if (binding.isLocalVar()){
int localIdx = binding.getLocalIndex();
if (localIdx < argLocalIndex) {
binding = alias(binding, bindings, localIdx);
if (binding != null) {
// the aliased param binding was not present so ensure it gets added to the
// binding set once we have finished iterating. there is no need to add it
// to the call bindings since we pass the aliased method param instead
aliasBindings.add(binding);
}
} else {
callArrayBindings.add(binding);
}
}
}
bindings.addBindings(aliasBindings);
// now iterate over the param vars and ensure they go into the call bindings list
iterator = bindings.iterator();
while (iterator.hasNext()) {
Binding binding = iterator.next();
if (binding.isParam()) {
callArrayBindings.add(binding);