Bug 187945 - Different output compared with other JS engines: can't find variable
Summary: Different output compared with other JS engines: can't find variable
Status: RESOLVED DUPLICATE of bug 163209
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 188784 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-07-24 00:54 PDT by sunlili
Modified: 2023-05-04 09:09 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***