logger.debug("Merging ...");
Iterator iter= sources.iterator();
while (iter.hasNext())
{
Node pred= (Node) iter.next();
dump(pred.stack, "Stack for " + pred);
}
int stackSize= -1;
iter= sources.iterator();
while (iter.hasNext())
{
Node pred= (Node) iter.next();
if (stackSize == -1)
{
stackSize= pred.stack.size();
}
else if (stackSize != pred.stack.size())
{
dump(sources);
throw new RuntimeException("Stack size mismatch");
}
}
for (int index= 0; index < stackSize; index++)
{
Object obj= stacksIdentical(sources, index);
if (obj instanceof Expression)
{
target.add((Expression) ((Expression) obj).clone());
logger.debug("\tIdentical: " + obj);
}
else
{
VariableBinding vb= methodDecl.createAnonymousVariableBinding((Type) obj, true);
target.add(vb);
iter= sources.iterator();
while (iter.hasNext())
{
Node node= (Node) iter.next();
Expression expr= (Expression) node.stack.get(index);
Assignment a= new Assignment(Assignment.Operator.ASSIGN);
a.setLeftHandSide((VariableBinding) vb.clone());
if (expr instanceof VariableBinding)