Fix: `__extends` helper above directive prologue
Code cleanup in Class

* Don't insert unnecessary `_ref` (in the wrong scope)
* Improve code prettiness. (Reverts most of 903e9c99)
Merge pull request #3224 from marchaefner/fixClassCompilation

Minor fixes for class compilation