Fix switch test-chain stack leftovers. Fix iterator on null and undefined.
Record whether a function is script or function code.

Script code returns the value of the last evaluated expression.
Function code returns the explicit return value or undefined.
Leave last evaluated expression on the stack for script code.

Pop before evaluating an expression statement, rather
than after. Keep track of the stack when looping and
exiting a for-in statement (which keeps the iterator
on the stack between statements).

This involves a few more stack gyrations during for-in statements,
so the code is predicated on compiling script code.