Skip to content

Conversation

@blakeembrey
Copy link
Contributor

Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)
  • repl
Description of change

Move the core logic from LineParser should fail handling into the recoverable error check for the REPL default eval. This was originally from #3488, and I've split it out for separate review and hopefully speed it up. The idea is to make the current recoverable check part of the default eval instead of limiting the usefulness of the REPL functionality to only JavaScript languages (E.g. enable TypeScript).

@mscdexmscdex added the repl Issues and PRs related to the REPL subsystem. label Apr 12, 2016
@blakeembreyblakeembrey mentioned this pull request Apr 15, 2016
@estliberitasestliberitasforce-pushed the master branch 2 times, most recently from 7da4fd4 to c7066fbCompareApril 26, 2016 05:23
lib/repl.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Could have a semicolon after the }?

Copy link
ContributorAuthor

@blakeembreyblakeembreyJun 17, 2016

Choose a reason for hiding this comment

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

Absolutely. I didn't want to change too much code with this refactor though - I've only changed how it's run (E.g. to run after the user hits enter, instead of each line). Here's the original check: https://github.com/nodejs/node/pull/6171/files/680c88111413ad25bafbe9d7578079d6c0ca5ff0#diff-b13d72249263845d8e8341db0426f9d3L426. Could definitely change to check to include a semicolon.

@Fishrock123
Copy link
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/3018/

Seems to me this changes enough properties that it is probably semver-major..

@Fishrock123Fishrock123 added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jun 17, 2016
@Fishrock123
Copy link
Contributor

Looks like the CI is refusing to run with a rebase, CI without rebasing: https://ci.nodejs.org/job/node-test-pull-request/3019/

@blakeembrey
Copy link
ContributorAuthor

@Fishrock123 I just rebased again on top of the changes that have occurred. Is there anything I can do to make this land? It'd be very convenient for myself and others that have built custom REPLs for transpiled programming languages.

I intend to use this to support running TypeScript in a REPL with multiple lines. Although not a big deal for TypeScript, since it follows JavaScript semantics, it's might be more useful for transpile language targets that may fail the existing "should code fail" checks used in the line parser. It also helps to separate the existing concerns that are mixed as new features get added to the JavaScript implementation that aren't relevant for transpiled languages.

@Fishrock123
Copy link
Contributor

@nodejs/collaborators can someone review?

@jasnell
Copy link
Member

@blakeembrey ... do you still want to pursue this?

@jasnelljasnell added the stalled Issues and PRs that are stalled. label Mar 1, 2017
@blakeembrey
Copy link
ContributorAuthor

blakeembrey commented Mar 1, 2017

@jasnell I will refactor again if someone will review it and thinks it's useful. Otherwise, not really. It is still required to improve interop with transpiler REPLs where recovery/new lines can be detected differently.

@jasnell
Copy link
Member

Yep. Understood. I'll commit to reviewing.

@targostargos self-assigned this Mar 1, 2017
@targos
Copy link
Member

I'll review it too.

@blakeembrey
Copy link
ContributorAuthor

blakeembrey commented Mar 3, 2017

@targos@jasnell I just updated the PR and it's passing locally. I'm not sure if the CI build is meant to be running?

Edit: I see I'm meant to wait (https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#ci-testing) 😄

@gibfahn
Copy link
Member

gibfahn commented Mar 3, 2017

CI 3: https://ci.nodejs.org/job/node-test-commit/8236/

EDIT: CI is green

@cjihrig
Copy link
Contributor

This has conflicts.

@gibfahn
Copy link
Member

@blakeembrey could you rebase?

Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval.
@blakeembrey
Copy link
ContributorAuthor

@cjihrig@gibfahn Updated again.

@targos
Copy link
Member

jasnell pushed a commit that referenced this pull request Mar 14, 2017
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. PR-URL: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
@jasnell
Copy link
Member

Landed in 39d9afe. Thank you @blakeembrey. Sorry again for this taking so long!

@jasnelljasnell closed this Mar 14, 2017
@blakeembreyblakeembrey deleted the repl-custom-eval branch March 14, 2017 22:10
@blakeembrey
Copy link
ContributorAuthor

Thanks @jasnell for landing this, and everyone else involved 😄

return;
}elseif(!self.bufferedCommand){
self.outputStream.write('Invalid REPL keyword\n');
if(trimmedCmd){
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 this broke the command line debugger. Previously an empty command would be sent to the eval function. Now <enter> is silently ignored.

The CLI debugger was using <enter> for "repeat last command".

Copy link
Member

Choose a reason for hiding this comment

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

Ugh. Ok, we can back it out if necessary but let's see if we can find a fix first.
/cc @blakeembrey

Copy link
Member

Choose a reason for hiding this comment

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

Let's also see if we can get a regression test added since this case obviously wasn't being tested in CI :-(

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this is super urgent, was just digging through why it passed against the last 8.x nightly but not against master.

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 the fix is as simple as removing that else branch: #11871

hybrist pushed a commit to hybrist/node that referenced this pull request Mar 15, 2017
jasnell pushed a commit that referenced this pull request Mar 17, 2017
This fixes a regression introduced in #6171 PR-URL: #11871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. PR-URL: nodejs#6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
This fixes a regression introduced in nodejs#6171 PR-URL: nodejs#11871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@jasnelljasnell mentioned this pull request Apr 4, 2017
@vsemozhetbytvsemozhetbyt mentioned this pull request Apr 27, 2017
2 tasks
vsemozhetbyt added a commit that referenced this pull request Apr 28, 2017
Delete unused method call. PR-URL: #12685 Refs: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@lance
Copy link
Member

lance commented Oct 4, 2017

Added backport-requested-v6.x since that will fix #15704. PR coming soon.

MylesBorins pushed a commit that referenced this pull request Nov 14, 2017
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. Fixes: #15704 Backport-PR-URL: #15773 PR-URL: #6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Nov 21, 2017
@targostargos removed their assignment Oct 31, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

replIssues and PRs related to the REPL subsystem.semver-majorPRs that contain breaking changes and should be released in the next major version.stalledIssues and PRs that are stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@blakeembrey@Fishrock123@jasnell@targos@gibfahn@cjihrig@lance@hybrist@mscdex