Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
repl: do not consider ... as a REPL command#14467
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
shivanth commented Jul 25, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
This fix makes ... in REPL to be considered as a javascript construct rather than a REPL keyword Fixes: nodejs#14426
Trott left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Please add a test! REPL tests can be tricky, but this is probably something that can be tested by adding something to test/parallel/test-repl.js. Additional info about our tests in general can be found in https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md
silverwind commented Jul 25, 2017
Change looks good. For adding a test, check out https://github.com/nodejs/node/blob/master/test/parallel/test-repl.js. |
lib/repl.js Outdated
| // display next prompt and return. | ||
| if(trimmedCmd){ | ||
| if(trimmedCmd.charAt(0)==='.'&&isNaN(parseFloat(trimmedCmd))){ | ||
| if(trimmedCmd.charAt(0)==='.'&&trimmedCmd.charAt(1)!='.'&&isNaN(parseFloat(trimmedCmd))){ |
TimothyGuJul 25, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use strict not equals, so trimmedCmd.charAt(1) !== '.'
mscdex commented Jul 25, 2017
FWIW commit message is missing a space after the colon. |
... as a REPL command... as a REPL commandrefack commented Jul 25, 2017
@shivanth thank for your contribution 🥇. Don't be alarmed by all the reviews, as far as I can see they are just in order to make your submission even better. I would really want to see you follow up, so this PR will land. |
refack commented Jul 25, 2017
P.S. as far as I can see this change also enables |
shivanth commented Jul 25, 2017
@refack The I came across this when I tried to add a new test case |
silverwind commented Jul 25, 2017
That's something that should be investigated separately. Any kind of invalid syntax does it, but is has its uses too: Same also works on the shell: The question is if it can be determined if a line can never be valid, like As a first step, I'm fine if you just make sure it not gets parsed as a REPL command. |
shivanth commented Jul 26, 2017
Because my test case is leaving the REPL in an inconsistent state, the tests that follow my new test fails ... |
shivanth commented Jul 26, 2017
Done 👍 |
shivanth commented Jul 27, 2017
Trott commented Jul 27, 2017
The test as it stands right now does not fail on current master so it is not testing the feature implemented here. |
Trott commented Jul 27, 2017
Fishrock123 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {client: client_unix,send: ' \t \n', | ||
| expect: prompt_unix} | ||
| expect: prompt_unix}, | ||
| //Do not parse `...[]` as a REPL keyword |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linter might fail due to no space between the comment start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It passes as we do not use the spaced-comment rule. I fixed it anyways.
silverwind commented Jul 29, 2017
Thanks, landed in 46d3ff2! I fixed the whitespace issues in the test and wrapped the long line in |
This fix makes ... in REPL to be considered as a javascript construct rather than a REPL keyword. Fixes: #14426 PR-URL: #14467 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
MylesBorins commented Aug 16, 2017
Should this be backported to |
silverwind commented Aug 16, 2017
I'd say so. @shivanth wanna do it? |
shivanth commented Aug 16, 2017
I'm in 👍 |
This fix makes ... in REPL to be considered as a javascript construct rather than a REPL keyword. Fixes: nodejs#14426 PR-URL: nodejs#14467 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
This fix makes ... in REPL to be considered as a javascript construct rather than a REPL keyword. Fixes: #14426 Backport-PR-URL: #14915 PR-URL: #14467 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
0joshuaolson1 commented Feb 27, 2018
Was an issue ever created for the aforementioned problem where some syntax errors put the repl in an 'inconsistent' I found #18915, but its a PR... |
This fix makes
...in REPL to be considered as a javascript constructrather than a REPL keyword
Fixes: #14426
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
repl