Fix workset iterations in scala frontend

We used the globalPos to create WorksetIteration, these are not
available before the post pass has run, therefore use the localPos for
now.

Also add maxIterations parameter to iterateWithWorkset