* TEST: var namespace = {}; namespace.A = class A { constructor() { console.log("a"); } }; namespace.B = class B extends namespace.A { constructor() { super(); console.log("b"); } }; new namespace.B(); * EXPECTED Logs for "a" and "b" * ACTUAL SyntaxError: Unexpected token '.'. Expected opening '{' at the start of a class body. * NOTES - Workaround: "class B extends (namespace.A) { ... }" - Works in Chrome 43. I don't know how to test Firefox with Classes.
I'll take a quick look. The spec says AssignmentExpression and the Parser is doing a PrimaryExpression.
Actually, this is a LeftHandSideExpression, according to the latest spec: ClassHeritage[Yield] : extends LeftHandSideExpression[?Yield]
Created attachment 248972 [details] [PATCH] Proposed Fix Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions
Comment on attachment 248972 [details] [PATCH] Proposed Fix Oops, I forgot to include expected results.
Created attachment 248973 [details] [PATCH] Proposed Fix
Comment on attachment 248973 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=248973&action=review > LayoutTests/js/script-tests/class-syntax-extends.js:42 > +shouldThrow('x = 1; c = class extends ++x { };'); Could you add an empty constructor here and the rest of test cases so that this test doesn't depend on the support for default constructor?
(In reply to comment #6) > Comment on attachment 248973 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=248973&action=review > > > LayoutTests/js/script-tests/class-syntax-extends.js:42 > > +shouldThrow('x = 1; c = class extends ++x { };'); > > Could you add an empty constructor here and the rest of test cases so that > this test doesn't depend on the support for default constructor? I did this for all the tests, and added a few that had the default constructor as well, to test all cases.
http://trac.webkit.org/changeset/181724