Skip to content

Conversation

@codebytere
Copy link
Member

@codebytere codebytere commented Feb 27, 2020

Follow-up to #31943.

In the PR above, repl eval was altered to eagerly try and wrap code with parens, but this could in some cases cause failures for code which is only valid JavaScript in an unwrapped state.

This PR makes that logic more robust by ensuring that the wrapped code is parsed to be valid JS before evaluation continues, and proceeds unwrapped if it is found to be invalid.

cc @devsnek @BridgeAR

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Feb 27, 2020
@BridgeAR
Copy link
Member

Is this actually necessary? The code is first checked as wrapped code and in case that fails it is run unwrapped.

@codebytere
Copy link
Member Author

Hmm looks like you're right - I was proceeding on the assumption it was based on the original issue but i think that was just my misreading! Closing :)

@codebytere codebytere closed this Mar 2, 2020
@codebytere codebytere deleted the repl-preview-try-again branch March 2, 2020 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants