Uh oh!
There was an error while loading. Please reload this page.
doc: update example of using await in REPL - #45939
Conversation
Invalidating the lexical scoping of the `const` and `let` keywords is fixed. Fixes: nodejs#45918
aduh95
left a comment
There was a problem hiding this comment.
Can we add a test for that?
deokjinkim
commented
Dec 22, 2022
Okay. I'll try to write test case for that. |
BridgeAR
left a comment
There was a problem hiding this comment.
The scope is still changed, if I am not mistaken:
>constm=awaitPromise.resolve(123)undefined>m123>m='Lexial scope changed!''Lexial scope changed!'>m'Lexial scope changed!'>vs.
>constm=123undefined>m123>m='Lexial scope changed!'UncaughtTypeError: Assignmenttoconstantvariable.>deokjinkim
commented
Dec 23, 2022
Lexical scope of `const` is only invalidated when using top-level `await` in REPL. Fixes: nodejs#45918
31508ee to
2de633cCompareawait in REPL
BridgeAR
left a comment
There was a problem hiding this comment.
The change is LGTM. I can't reproduce any other behavior anymore.
Ideally we could add a test case that validates the outcome accordingly.
deokjinkim
commented
Jan 3, 2023
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
| ['const k = await Promise.resolve(123)'], | ||
| ['k', '123'], | ||
| ['k = await Promise.resolve(234)', '234'], | ||
| ['k', '234'], |
There was a problem hiding this comment.
And the drive the point home:
| ['k','234'], | |
| ['k','234'], | |
| ['const k = await Promise.resolve(345)'], | |
| ['k','345'], |
There was a problem hiding this comment.
line 180 causes error like 'Uncaught SyntaxError: Identifier 'k' has already been declared'.
When I tested,
// This is allowed
const k = await Promise.resolve(123)
k = await Promise.resolve(234)
// This is not allowed
const k = await Promise.resolve(123)
const k = await Promise.resolve(234)
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
BridgeAR
commented
Sep 11, 2025
The mentioned issue seems to be resolved by another PR. |
Lexical scope of
constis only invalidated whenusing top-level
awaitin REPL.Fixes: #45918