Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugger: fix behavior of { a: 1 } in the debugger repl #46924

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

meixg
Copy link
Member

@meixg meixg commented Mar 3, 2023

fix: #46808

@nodejs-github-bot nodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels Mar 3, 2023
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself is LGTM. I think we should add a test though?

input = match ? match[1] : input;

// Add parentheses to make sure input is parsed as expression
if (RegExpPrototypeExec(/^\s*{/, input) !== null &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also should append lib/internal/debugger/inspect_repl.js to this comment:

node/lib/repl.js

Lines 417 to 421 in 31156a7

// It's confusing for `{ a : 1 }` to be interpreted as a block
// statement rather than an object literal. So, we first try
// to wrap it in parentheses, so that it will be interpreted as
// an expression. Note that if the above condition changes,
// lib/internal/repl/utils.js needs to be changed to match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different behavior of { a: 1 } in the REPL and the debugger
4 participants