WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
142840
ES6 Classes: Extends should accept an expression without parenthesis
https://bugs.webkit.org/show_bug.cgi?id=142840
Summary
ES6 Classes: Extends should accept an expression without parenthesis
Joseph Pecoraro
Reported
2015-03-18 14:38:57 PDT
* 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.
Attachments
[PATCH] Proposed Fix
(4.89 KB, patch)
2015-03-18 15:21 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
[PATCH] Proposed Fix
(8.24 KB, patch)
2015-03-18 15:24 PDT
,
Joseph Pecoraro
rniwa
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2015-03-18 14:40:33 PDT
I'll take a quick look. The spec says AssignmentExpression and the Parser is doing a PrimaryExpression.
Joseph Pecoraro
Comment 2
2015-03-18 14:57:32 PDT
Actually, this is a LeftHandSideExpression, according to the latest spec: ClassHeritage[Yield] : extends LeftHandSideExpression[?Yield]
Joseph Pecoraro
Comment 3
2015-03-18 15:21:38 PDT
Created
attachment 248972
[details]
[PATCH] Proposed Fix Reference:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions
Joseph Pecoraro
Comment 4
2015-03-18 15:22:38 PDT
Comment on
attachment 248972
[details]
[PATCH] Proposed Fix Oops, I forgot to include expected results.
Joseph Pecoraro
Comment 5
2015-03-18 15:24:36 PDT
Created
attachment 248973
[details]
[PATCH] Proposed Fix
Ryosuke Niwa
Comment 6
2015-03-18 15:59:36 PDT
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?
Joseph Pecoraro
Comment 7
2015-03-18 20:29:00 PDT
(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.
Joseph Pecoraro
Comment 8
2015-03-18 20:29:07 PDT
http://trac.webkit.org/changeset/181724
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug