google / traceur-compiler

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

Regression concerning arrow functions #1962

Closed johsin18 closed 9 years ago

johsin18 commented 9 years ago

In Traceur 0.89, the following code

    this._observer = {
        onDChanged: (uuid, d) => {
            if (this.downStreamObserver)
                this.downStreamObserver.onDChanged(uuid, d);
            this.onChanged();
        },

was compiled to this working code

  this._observer = {
    onDChanged: ($__5 = this, function(uuid, d) {
      if ($__5.downStreamObserver)
        $__5.downStreamObserver.onDChanged(uuid, d);
      $__5.onChanged();
    }),

However, starting from 0.90, some extra parentheses are gone...

this._observer = {
    onDChanged: $__5 = this, function(uuid, d) {
      if ($__5.downStreamObserver)
        $__5.downStreamObserver.onDChanged(uuid, d);
      $__5.onChanged();
    },

which completely breaks the code, as onDChanged is basically set to "this" instead of the function intended.

arv commented 9 years ago

Sorry about the regression :'(