RESOLVED DUPLICATE of bug 151113 155060
Second call to super() should fail
https://bugs.webkit.org/show_bug.cgi?id=155060
Summary Second call to super() should fail
Ryosuke Niwa
Reported 2016-03-04 20:07:18 PST
class A { } class B extends A { constructor() { super(); console.log('hi'); super(); } } should fail immediately after 'hi' since "this" is already created. Specifically, step 10 in SuperCall: http://www.ecma-international.org/ecma-262/6.0/#sec-super-keyword-runtime-semantics-evaluation 10. Return thisER.BindThisValue(result). should throw a ReferenceError because of step 3: http://www.ecma-international.org/ecma-262/6.0/#sec-bindthisvalue 3. If envRec.[[thisBindingStatus]] is "initialized", throw a ReferenceError exception.
Attachments
GSkachkov
Comment 1 2016-03-04 23:16:10 PST
We have very close issue to this https://bugs.webkit.org/show_bug.cgi?id=151113 that rely on discussion https://esdiscuss.org/topic/duplicate-super-call-behaviour test example: class Foo { constructor() { console.log("foo"); } } class Bar extends Foo { constructor() { super(); console.log("bar"); super(); } } new Bar; If we will strictly follow specs we will have: foo bar foo ReferenceError: This can not be initialized twice.
Ryosuke Niwa
Comment 2 2016-04-10 23:59:01 PDT
Does your patch for the bug 151113 also fix this bug? Or do we still need to keep this bug around?
GSkachkov
Comment 3 2016-04-11 00:01:47 PDT
(In reply to comment #2) > Does your patch for the bug 151113 also fix this bug? Or do we still need > to keep this bug around? Yes, I think it is the same issue, so path for 151113 fix this issue.
Ryosuke Niwa
Comment 4 2016-04-11 00:02:21 PDT
Let's dupe this bug in that case. *** This bug has been marked as a duplicate of bug 151113 ***
Note You need to log in before you can comment on or make changes to this bug.