Skip to content

let properties of global scope don't persist #4667

@aubergineagain

Description

@aubergineagain

See this: #1861 (comment)

After discussion with KJeff01, unfortunately we are hitting a critical issue:

const and let variables are not enumerated when enumerating properties of the global object, and thus:

  • are not visible in the Script Debugger
  • CRITICAL: are not saved

This breaks a lot.

So until someone has a chance to figure out how to better enumerate variables in the global namespace in QuickJS such that these variables are included, we can't merge this as-is. (const variables do not have to be saved, but it would be nice if they were optionally viewable in the Script Debugger... but let variables absolutely need to be enumerated and saved)

At a minimum, all global variables (that need to be saved) need to be made var again.

And this: https://discord.com/channels/684098359874814041/684135842612379677/1441041070665240708

I wasn't even able to persist a simple number:

let index = 0;

function eventStartLevel() {
  index = 1
}
function eventGameLoaded() {
  console(index) // prints 0
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions