Fix code gen for classes so that the stack trace looks nicer.

Wrap runtime calls in parens so that `$__class` does not show up in stack traces.

Merge `$__class` and `$__classExt` into one function.

Restructure the temp vars a bit to provide cleaner stack traces.