public MethodNode tryFindPossibleMethod(String name, Expression arguments) {
int count = 0;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
// TODO this won't strictly be true when using list expansion in argument calls
count = tuple.getExpressions().size();
} else
return null;
MethodNode res = null;
ClassNode node = this;
TupleExpression args = (TupleExpression) arguments;
do {
for (MethodNode method : node.getMethods(name)) {
if (method.getParameters().length == count) {
boolean match = true;
for (int i = 0; i != count; ++i)
if (!args.getType().isDerivedFrom(method.getParameters()[i].getType())) {
match = false;
break;
}
if (match) {