On Sun, Aug 24, 2014 at 3:22 PM, Isiah Meadows <[email protected]> wrote:

> I know this wouldn't be a common use case, but might come into play with
> minifiers later on. Would any of the following be potentially valid in ES6?
>
>     class Foo extends function() {} { /* class body */ }
>

This is valid:

  class F extends function () { this.prop = 1; } {
    constructor() {
      super();
    }
  }

  var f = new F();
  console.log(f.prop === 1); //  true



>      class Foo extends function* (bar) { yield bar } { /* class body */ }
>

This won't work correctly: the constructor method of Foo can't be a
generator method:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-constructormethod
,
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-classdefinitionevaluation.
This is all further detailed here:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-objects,
specifically:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-constructor


>     class Foo extends class { /* super body */ } { /* class body */ }
>

This is valid:

  class C extends class { get() { return 1; } } {
    constructor() {
      super();
    }
  }

  var c = new C();

  console.log(c.get() === 1); // true



Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to