WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
149001
ES6 classes: When a class extends B, super() invokes B.prototype.constructor() instead of B()
https://bugs.webkit.org/show_bug.cgi?id=149001
Summary
ES6 classes: When a class extends B, super() invokes B.prototype.constructor(...
Claude Pache
Reported
2015-09-09 07:11:02 PDT
Testcase: ```js var called = null class B { constructor() { called = 'B' } } class C extends B {} B.prototype.constructor = function F() { called = 'F' } new C called // should be 'B', is 'F' ``` It seems to me that JSC follows an old drafted semantics of `super()`, when it was equivalent to `super.constructor()`. For reference, see the runtime semantics of `SuperCall : super Arguments` in the final spec:
http://www.ecma-international.org/ecma-262/6.0/#sec-super-keyword-runtime-semantics-evaluation
and pay attention to the definition of GetSuperConstructor():
http://www.ecma-international.org/ecma-262/6.0/#sec-getsuperconstructor
Attachments
Patch
(12.58 KB, patch)
2015-10-11 04:29 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(12.62 KB, patch)
2015-10-11 04:30 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2015-10-11 04:29:31 PDT
Created
attachment 262857
[details]
Patch
Yusuke Suzuki
Comment 2
2015-10-11 04:30:56 PDT
Created
attachment 262858
[details]
Patch
Saam Barati
Comment 3
2015-10-11 09:55:57 PDT
Comment on
attachment 262858
[details]
Patch r=me Does the latest spec change the "emitSuperBaseForCallee" static function in BytecodeGenerator?
Yusuke Suzuki
Comment 4
2015-10-11 10:41:07 PDT
(In reply to
comment #3
)
> Comment on
attachment 262858
[details]
> Patch > > r=me > Does the latest spec change the "emitSuperBaseForCallee" static function in > BytecodeGenerator?
Yup. emitSuperBaseForCallee is correct in the latest spec :)
http://ecma-international.org/ecma-262/6.0/#sec-getsuperbase
WebKit Commit Bot
Comment 5
2015-10-11 11:47:26 PDT
Comment on
attachment 262858
[details]
Patch Clearing flags on attachment: 262858 Committed
r190847
: <
http://trac.webkit.org/changeset/190847
>
WebKit Commit Bot
Comment 6
2015-10-11 11:47:31 PDT
All reviewed patches have been landed. Closing bug.
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