// 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);
} else if (binding.isReturn()) {
// in order to be able to add the return value to the args array
// we have to add a local var to store the value so track that requirement
bindReturnOrThrowableValue = true;
saveValueType = getReturnBindingType();
binding.setDescriptor(saveValueType.getClassName());
callArrayBindings.add(binding);
} else if (binding.isThrowable()) {
// in order to be able to add the return value or throwable value to the args array
// we have to add a local var to store the value so track that requirement
bindReturnOrThrowableValue = true;
// TODO -- allow type to be more accurately identified than this
saveValueType = Type.getType("Ljava/lang/Throwable;");
callArrayBindings.add(binding);
} else if (binding.isParamCount() || binding.isParamArray()) {
callArrayBindings.add(binding);
} else if (binding.isInvokeParamArray()) {
// in order to be able to ad th einvoke parameters to the args array we
// have to add a local var to store the value so track that requirement
callArrayBindings.add(binding);
bindInvokeParams = true;
}