[Webkit-unassigned] [Bug 149001] New: ES6 classes: When a class extends B, super() invokes B.prototype.constructor() instead of B()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 9 07:11:02 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=149001

            Bug ID: 149001
           Summary: ES6 classes: When a class extends B, super() invokes
                    B.prototype.constructor() instead of B()
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: claude.pache at gmail.com

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150909/54288efb/attachment.html>


More information about the webkit-unassigned mailing list