Rick Waldron (2014-08-24T22:03:04.000Z)
domenic at domenicdenicola.com (2014-08-26T18:31:22.335Z)
On Sun, Aug 24, 2014 at 3:22 PM, Isiah Meadows <impinball at gmail.com> 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: ```js 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: ```js class C extends class { get() { return 1; } } { constructor() { super(); } } var c = new C(); console.log(c.get() === 1); // true ```