else if (methodName.equals("size")) {
return factory.getNothing();
}
else if (methodName.equals("toArray") && numArgs == 0) {
Variable result = factory.createVariable(VariableType.ARRAY);
factory.addStatement(new ArrayNew(result));
factory.addStatement(new ArrayAddAll(result, callee));
return result;
}
else if (methodName.equals("toArray") && numArgs == 1) {
Variable result = factory.createVariable(VariableType.ARRAY);
// the elements MIGHT be stored into the argument
factory.startBranch();
// 1) not stored in argument
{
factory.addStatement(new ArrayNew(result));
factory.useBranch();
}
// 2) stored in argument
{
// note: existing elements in the array may remain