<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><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> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES2016] Allow assignment in for-in head in not-strict mode"
   href="https://bugs.webkit.org/show_bug.cgi?id=160955">bug 160955</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;">Attachment #286712 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES2016] Allow assignment in for-in head in not-strict mode"
   href="https://bugs.webkit.org/show_bug.cgi?id=160955#c11">Comment # 11</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES2016] Allow assignment in for-in head in not-strict mode"
   href="https://bugs.webkit.org/show_bug.cgi?id=160955">bug 160955</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=286712&amp;action=diff" name="attach_286712" title="Patch">attachment 286712</a> <a href="attachment.cgi?id=286712&amp;action=edit" title="Patch">[details]</a></span>
Patch

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

r=me with one request:

Can you see what should be done for the following type of programs:
```
function foo() {
    {
        let x = 50;
        for (var x = 25 in {}) { }
        // what is x here?
    }
    // and what is x here?
}
foo();

and

function foo() {
    {
        const x = 50;
        for (var x = 25 in {}) { }
       // Should we throw a const assignment error?
    }
}
foo();
```
Currently, both Firefox and Chrome throw syntax errors for these programs. However, I suspect that's not the correct behavior as defined by the spec.
If it is, we should also throw a syntax error. If it isn't, we should make sure we do the right thing. I suspect that in the first example,
in the &quot;let x&quot; scope, x should be 25. In the &quot;var&quot; scope of the function, I suspect x should be undefined. But who knows.

<span class="quote">&gt; Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:2560
&gt; +void ForInNode::emitResolveVariable(BytecodeGenerator&amp; generator, RegisterID* propertyName, const Identifier&amp; ident)</span >

Suggestion: An alternative to defining a method is you can just use a local lambda inside the ::emitLoopHeader that does this.</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>