google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.18k stars 580 forks source link

Arrow function compiled incorrectly when extending a class #1987

Closed letmaik closed 8 years ago

letmaik commented 8 years ago

Whenever I extend a class and try to define an arrow function like below, the output is broken:

class X extends Error {
  constructor() {
    super()
    this.foo = () => {this.bar()}
  }
}

becomes:

      X = function($__super) {
        function X() {
          var $__1;
          $traceurRuntime.superConstructor(X).call(this);
          this.foo = $__1 = this, function() {
            $__1.bar();
          };
        }
        return ($traceurRuntime.createClass)(X, {}, {}, $__super);
      }(Error);

I use 0.0.91.