Ah, completely right. At first glance I thought it was this similar but 
separate issue:



```js


class Foo {

  constructor(callback) {

    this.callback = callback; // just storing it!

  }

}




class Bar extends Foo {

  constructor() {

    super(() => this); // reference to `this` will throw since the behaviour of 
the super class can’t be easily inferred

  }

}



```




Shifting runtime errors to compile time isn’t always the most reliable.

On Tue, Jun 2, 2015 at 11:43 PM, Domenic Denicola <d...@domenic.me> wrote:

> Hmm I am pretty sure Babel et al. are correct here in not allowing this. The 
> super call needs to *finish* before you can use `this`. Chrome also works 
> this way.
> The correct workaround is
> ```js
> let resolve, reject;
> super((a, b) => {
>   resolve = a;
>   reject = b;
> });
> // use this
> ```
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to