Fix optimizations

So the optimizations just stopped activating a while back and nobody noticed because it's based on `JsVar` for top-level names but it was changed to `JsSetQName`. This passes the tests but I'm not sure everything's still honky dory. I'm testing it out.

I'll try to accompany this with a change to the test suite to include actually looking at the result of the codegen to see that optimization occurred. The optimizations are to remove redundant thunking and to uncurry saturated function applications.