[Webkit-unassigned] [Bug 149338] [ES6] Arrow function created before super() causes TDZ, should it?

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 29 11:08:30 PDT 2015


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

Filip Pizlo <fpizlo at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fpizlo at apple.com

--- Comment #4 from Filip Pizlo <fpizlo at apple.com> ---
(In reply to comment #3)
> I think we can be smart and not do anything if the "this"
> isn't used in the arrow function. But after speaking with Joe, 
> I believe it should never throw on construction. The "this"
> should be under TDZ, which means it should be only dependent on
> time and not location in code. So, as long as super() is invoked
> before a "this" is evaluated inside the arrow function, we should
> be okay. For example, this is ok:
> 
> class C {
>     constructor() {
>         let x = () => (false ? this : 20);
>         x();
>         super();
>     }
> }

And also things like this should work:

class C {
    constructor() {
        let p = false;
        let x = () => (p ? this : 20);
        x(); // returns 20
        super();
        p = true;
        x(); // returns 'this'
    }
}

This should return without throwing.

-- 
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/20150929/9810c916/attachment.html>


More information about the webkit-unassigned mailing list