Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is straw-man PR to discuss whether we want to distinguish "global" and "file" ("script" or "module") scope.
An example of this may be the following:
Both Firefox DevTools and Chrome DevTools would show different scopes for
a
andb
. Specificallya
would be in the "global" scope as it gets hoisted toglobalThis
/window
. Whereasb
would be only in the "script" scope.This could simplify handling of the "global" scope across multiple authored files. To expand on the initial example let's add another file:
And the combined bundle:
If we pause on the debugger statement then the expected scope chain is:
barB: 'bar'
foo: 'a'
fooB: 'foo'
Since the global scope is combined. Generators can achieve this by generating the following "generated ranges" for the bundle:
(1) and (2) are the respective "global" scopes. (3) is the file scope of
a.js
and (4) is the file scope ofb.js
.