Propagate loop count throughout the lexical context

This should make sure that the method containing a loop gets compiled properly, and not just a block that contains a loop.

Signed-off-by: Stefan Marr <git@stefan-marr.de>