Uh oh!
There was an error while loading. Please reload this page.
repl: do not consider ... as a REPL command - #14467
Conversation
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.
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. |
| // display next prompt and return. | ||
| if (trimmedCmd) { | ||
| if (trimmedCmd.charAt(0) === '.' && isNaN(parseFloat(trimmedCmd))) { | ||
| if (trimmedCmd.charAt(0) === '.' && trimmedCmd.charAt(1) != '.' && isNaN(parseFloat(trimmedCmd))) { |
There was a problem hiding this comment.
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
| { 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.
the linter might fail due to no space between the comment start?
There was a problem hiding this comment.
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 |
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 <me@silverwind.io> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
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 <me@silverwind.io> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
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