Fix loop bugs

Some fixes for bugs while emitting for/while loops:

1. In some cases loop variables are never initialized. See loop-forunbounded and loop-forvariants test cases for example.

2. In some cases when a while loop wasn't emitted (due to loop analysis being incomplete for instance) the emitted GLSL would skip assignments / declarations of certain loop variables. See the newly added test case bug-loops-for-while for example.

Let me know if you have any questions.