Bug 187945

Summary: Different output compared with other JS engines: can't find variable
Product: WebKit Reporter: sunlili
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: email, fpizlo, mark.lam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description sunlili 2018-07-24 00:54:10 PDT
Hello,
    Running following js code:
-----------------------------------
let testCases = [                                                                                                              
  function() {
    return {
      start: 0,
      end: 100,
      test: function test() {
      }   
    };  
  },  
];
for(let testCase of testCases) {
  let testInfo = testCase();

  function run() {
      print(testInfo);
  }

  run();

}

print("BT_FLAG");
-----------------------------------

    Output of ch, v8 and firefox:
[object Object]
BT_FLAG

    However, output of jsc is:
Exception: ReferenceError: Can't find variable: testInfo


BT group
2018.7.24
Comment 1 Yusuke Suzuki 2018-08-31 04:24:49 PDT
*** Bug 188784 has been marked as a duplicate of this bug. ***
Comment 2 email 2023-05-03 15:30:27 PDT
This bug makes ES6 code unusable if wrapped in a block, such as in Confluence Data Center plugins: https://community.developer.atlassian.com/t/resource-batching-breaks-closure-compiled-es6-code-in-safari/68909

"Different output" is a pretty severe understatement. "Horribly incorrect output" would be more accurate.
Comment 3 Radar WebKit Bug Importer 2023-05-04 08:41:51 PDT
<rdar://problem/108894656>
Comment 4 Yusuke Suzuki 2023-05-04 09:09:15 PDT
This is Annex B feature.

*** This bug has been marked as a duplicate of bug 163209 ***