Bug 144282 - new super should be a syntax error
Summary: new super should be a syntax error
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-04-27 15:17 PDT by Erik Arvidsson
Modified: 2015-05-04 12:24 PDT (History)
7 users (show)

See Also:


Attachments
Fixes the bug (5.22 KB, patch)
2015-05-03 16:26 PDT, Ryosuke Niwa
joepeck: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2015-04-27 15:17:49 PDT
http://trac.webkit.org/browser/trunk/LayoutTests/js/script-tests/class-syntax-super.js#L44

shouldNotThrow('x = class extends Base { constructor() { super(); } method() { return new super } }');

This is invalid. `new super` is not allowed.
Comment 1 Ryosuke Niwa 2015-04-27 15:28:50 PDT
*** Bug 144281 has been marked as a duplicate of this bug. ***
Comment 2 Ryosuke Niwa 2015-05-03 16:26:39 PDT
Created attachment 252291 [details]
Fixes the bug
Comment 3 Joseph Pecoraro 2015-05-04 12:08:11 PDT
Comment on attachment 252291 [details]
Fixes the bug

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

r=me

> Source/JavaScriptCore/ChangeLog:3
> +        ES6 classe: new super is not allowed

Typo: "classe" => "classes"

> Source/JavaScriptCore/parser/Parser.cpp:2527
> +    semanticFailIfTrue(baseIsSuper && newCount, "Cannot new super");

I think there is room for improvement with this error message. The statement "Cannot new super" feels incomplete. Maybe "Cannot use new with super"? "Cannot call super as a constructor"?
Comment 4 Ryosuke Niwa 2015-05-04 12:21:33 PDT
Comment on attachment 252291 [details]
Fixes the bug

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

>> Source/JavaScriptCore/parser/Parser.cpp:2527
>> +    semanticFailIfTrue(baseIsSuper && newCount, "Cannot new super");
> 
> I think there is room for improvement with this error message. The statement "Cannot new super" feels incomplete. Maybe "Cannot use new with super"? "Cannot call super as a constructor"?

Let's go with "Cannot use new with super".
Comment 5 Ryosuke Niwa 2015-05-04 12:22:44 PDT
Committed r183757: <http://trac.webkit.org/changeset/183757>
Comment 6 Ryosuke Niwa 2015-05-04 12:24:30 PDT
Thanks for the review, Joe!