Bug 142774 - Enable ES6 classes by default
Summary: Enable ES6 classes by default
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 140491
  Show dependency treegraph
 
Reported: 2015-03-16 21:54 PDT by Ryosuke Niwa
Modified: 2015-03-17 15:42 PDT (History)
6 users (show)

See Also:


Attachments
Enables the feature (58.19 KB, patch)
2015-03-16 22:11 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed double ChangeLog (57.97 KB, patch)
2015-03-16 22:12 PDT, Ryosuke Niwa
barraclough: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-03-16 21:54:27 PDT
Now that default constructor is supported, we're ready for the prime time!
Comment 1 Ryosuke Niwa 2015-03-16 22:11:32 PDT
Created attachment 248814 [details]
Enables the feature
Comment 2 Ryosuke Niwa 2015-03-16 22:12:27 PDT
Created attachment 248815 [details]
Fixed double ChangeLog
Comment 3 Ryosuke Niwa 2015-03-16 22:54:27 PDT
Thanks for the review!
Comment 4 Ryosuke Niwa 2015-03-16 22:56:18 PDT
Committed r181618: <http://trac.webkit.org/changeset/181618>
Comment 5 Joseph Pecoraro 2015-03-17 14:21:30 PDT
Comment on attachment 248815 [details]
Fixed double ChangeLog

View in context: https://bugs.webkit.org/attachment.cgi?id=248815&action=review

> LayoutTests/js/script-tests/class-syntax-super.js:55
> -shouldThrow('new (class extends Base { constructor() { } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."');
> +shouldThrow('new (class extends Base { constructor() { } })', '"ReferenceError: Cannot access uninitialized variable."');

This error message can certainly be improved. I don't see what is wrong here. Is it a missing call to super()?
Comment 6 Ryosuke Niwa 2015-03-17 15:42:06 PDT
(In reply to comment #5)
> Comment on attachment 248815 [details]
> Fixed double ChangeLog
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=248815&action=review
> 
> > LayoutTests/js/script-tests/class-syntax-super.js:55
> > -shouldThrow('new (class extends Base { constructor() { } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."');
> > +shouldThrow('new (class extends Base { constructor() { } })', '"ReferenceError: Cannot access uninitialized variable."');
> 
> This error message can certainly be improved. I don't see what is wrong
> here. Is it a missing call to super()?

Yes. The problem here is that constructor() {} doesn't initialize "this" so we can't return safely.