[Webkit-unassigned] [Bug 189799] New: Incorrect per-iteration bindings in for-loop

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 20 12:56:54 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=189799

            Bug ID: 189799
           Summary: Incorrect per-iteration bindings in for-loop
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dpaddock at esri.com

Test code:

let callback1;
let callbacks2 = new Array();
let callbacks3 = new Array();

for (
    let i = (callback1 = () => i, 0);
    callbacks2.push(() => i), i < 5;
    callbacks3.push(() => i), i++) {
    // loop body
    i++;
}

console.log(callback1());
console.log(callbacks2[0]());
console.log(callbacks3[0]());

Expected output (works in Chrome and Firefox)

0
1
3

Actual output in Safari TP 65:

1
1
3

Note: I found this test code at: https://github.com/Microsoft/TypeScript/issues/17632

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180920/37a0966e/attachment.html>


More information about the webkit-unassigned mailing list