<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments""
href="https://bugs.webkit.org/show_bug.cgi?id=145132#c52">Comment # 52</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments""
href="https://bugs.webkit.org/show_bug.cgi?id=145132">bug 145132</a>
from <span class="vcard"><a class="email" href="mailto:sbarati@apple.com" title="Saam Barati <sbarati@apple.com>"> <span class="fn">Saam Barati</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=268326&action=diff" name="attach_268326" title="Patch">attachment 268326</a> <a href="attachment.cgi?id=268326&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=268326&action=review">https://bugs.webkit.org/attachment.cgi?id=268326&action=review</a>
<span class="quote">> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:83
> + if (m_codeBlock->isStrictMode())
> + emitTDZCheck(argumentsRegister);</span >
why would we ever need a TDZ check here?
<span class="quote">> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4123
> +RegisterID* BytecodeGenerator::emitPutArgumentsToArrowFunctionContextBlockScope()</span >
I see what you're going for here in this function, but this seems a bit hacky to me.
I think there might be an alternate solution that might be cleaner:
We currently don't allow functions to declare the variable named "arguments"
as being captured (you can see this in the "collectFreeVariables" function inside Parser.h).
But, in the case of an arrow function, we really do want "arguments" to act like a captured variable.
If we teach the parser we can really capture "arguments", then we could probably do away
with a lot of this specialized code. We wouldn't need this function (because "arguments" would already
be in whatever environment is represented by scopeRegister()). We probably wouldn't need a specialized
argumentsLocalPrivateName either. We would need some BytecodeGenerator code just to teach it
that we don't have a local "arguments" that we created, but that's about it. I think most of this change
could be a parser change.
You would basically have to teach the parser that any arrow function implicitly captures the name "arguments".
Or we could be smart about it, and only capture "arguments" if we use "arguments" or "eval" inside the
arrow function.</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>