interpreter: Refactor duplicate work handling
interpreter: Refactor duplicate work handling

This moves the handling of duplicates to addWork(), so duplicate
work is not even added, which should be more efficient. We have
to move the handling of outputs in range statements a bit to
accomodate this change, but things are nicer now.

julian-klode/lingolang