<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#c55">Comment # 55</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:gskachkov@gmail.com" title="GSkachkov <gskachkov@gmail.com>"> <span class="fn">GSkachkov</span></a>
</span></b>
<pre>Comment on <span class="bz_obsolete"><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:4123
>> +RegisterID* BytecodeGenerator::emitPutArgumentsToArrowFunctionContextBlockScope()
>
> 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.</span >
Fixed. Oh I did not know about this collectFreeVariables. This approach is much better because allow to decrease amount of code</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>