mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:18:11 +00:00
LibJS: Fix runaway let scope when parsing for-in/of statements
This requires variables that should be exported to the script host or to other scripts to be declared as var (such as in test-common.js), since lexically-scoped variables won't be visible.
This commit is contained in:
parent
793e1bf28a
commit
c194afd17c
2 changed files with 10 additions and 9 deletions
|
@ -1,10 +1,10 @@
|
|||
let describe;
|
||||
let test;
|
||||
let expect;
|
||||
var describe;
|
||||
var test;
|
||||
var expect;
|
||||
|
||||
// Stores the results of each test and suite. Has a terrible
|
||||
// name to avoid name collision.
|
||||
let __TestResults__ = {};
|
||||
var __TestResults__ = {};
|
||||
|
||||
// So test names like "toString" don't automatically produce an error
|
||||
Object.setPrototypeOf(__TestResults__, null);
|
||||
|
@ -12,7 +12,7 @@ Object.setPrototypeOf(__TestResults__, null);
|
|||
// This array is used to communicate with the C++ program. It treats
|
||||
// each message in this array as a separate message. Has a terrible
|
||||
// name to avoid name collision.
|
||||
let __UserOutput__ = [];
|
||||
var __UserOutput__ = [];
|
||||
|
||||
// We also rebind console.log here to use the array above
|
||||
console.log = (...args) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue