<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:fpizlo@apple.com" title="Filip Pizlo <fpizlo@apple.com>"> <span class="fn">Filip Pizlo</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Arrow function created before super() causes TDZ, should it?"
href="https://bugs.webkit.org/show_bug.cgi?id=149338">bug 149338</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>fpizlo@apple.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Arrow function created before super() causes TDZ, should it?"
href="https://bugs.webkit.org/show_bug.cgi?id=149338#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Arrow function created before super() causes TDZ, should it?"
href="https://bugs.webkit.org/show_bug.cgi?id=149338">bug 149338</a>
from <span class="vcard"><a class="email" href="mailto:fpizlo@apple.com" title="Filip Pizlo <fpizlo@apple.com>"> <span class="fn">Filip Pizlo</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=149338#c3">comment #3</a>)
<span class="quote">> 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();
> }
> }</span >
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>