Bug 142774

Summary: Enable ES6 classes by default
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: JavaScriptCoreAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, benjamin, fpizlo, ggaren, saam, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 140491    
Attachments:
Description Flags
Enables the feature
none
Fixed double ChangeLog barraclough: review+

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.