<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 &quot;arguments&quot;"
   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 &quot;arguments&quot;"
   href="https://bugs.webkit.org/show_bug.cgi?id=145132">bug 145132</a>
              from <span class="vcard"><a class="email" href="mailto:sbarati&#64;apple.com" title="Saam Barati &lt;sbarati&#64;apple.com&gt;"> <span class="fn">Saam Barati</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=268326&amp;action=diff" name="attach_268326" title="Patch">attachment 268326</a> <a href="attachment.cgi?id=268326&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=268326&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=268326&amp;action=review</a>

<span class="quote">&gt; Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:83
&gt; +            if (m_codeBlock-&gt;isStrictMode())
&gt; +                emitTDZCheck(argumentsRegister);</span >

why would we ever need a TDZ check here?

<span class="quote">&gt; Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4123
&gt; +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 &quot;arguments&quot;
as being captured (you can see this in the &quot;collectFreeVariables&quot; function inside Parser.h).
But, in the case of an arrow function, we really do want &quot;arguments&quot; to act like a captured variable.
If we teach the parser we can really capture &quot;arguments&quot;, then we could probably do away
with a lot of this specialized code. We wouldn't need this function (because &quot;arguments&quot; 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 &quot;arguments&quot; 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 &quot;arguments&quot;.
Or we could be smart about it, and only capture &quot;arguments&quot; if we use &quot;arguments&quot; or &quot;eval&quot; 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>