-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
repl: declare for initial expression in the for loop, instead of hoisting and re-using #29535
Conversation
* Adds a to a variable declaration in a for loop that wasn't using anything.
The loop is using a previously declared |
@mscdex ah, i see it. however, it is not consistent with how the other loops are doing things. And it is also going across functions which seems wrong. I also realize this code base dates back a while, but i think we can start to clean things up like this, when hoisting all your variables to the top of the function was the thing to do perhaps the title of the issue could change to better reflect what is being done? I also saw a couple more for loops where that variable was being used. i'm going to update the PR with those also. |
i missed a couple in the previous commit. this also removes the hoisted variable that was being used for those loops This can be squashed
@lholmquist Personally, I think a separate commit is fine, given that that reduces the likelihood of merge conflicts with this PR. Others may feel differently, though. |
@addaleax thanks for the tip. I might just wait until this is merged, then send another PR(referencing this one), just so it doesn't clutter this PR to much |
Landed in 30e919a |
* Adds `let` to a variable declaration in a for loop that wasn't using anything. * Declare the for initial expression in the for loop. * Remove hoisted variables for loops. PR-URL: #29535 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* This goes along with the PR, nodejs#29535, that started to clean up the repl module. This PR replaces the instances of var with let/const.
Refs: #29535 This PR replaces the instances of var with let/const. PR-URL: #29575 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* Adds `let` to a variable declaration in a for loop that wasn't using anything. * Declare the for initial expression in the for loop. * Remove hoisted variables for loops. PR-URL: #29535 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: #29535 This PR replaces the instances of var with let/const. PR-URL: #29575 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* Adds `let` to a variable declaration in a for loop that wasn't using anything. * Declare the for initial expression in the for loop. * Remove hoisted variables for loops. PR-URL: #29535 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: #29535 This PR replaces the instances of var with let/const. PR-URL: #29575 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
There was a for loop that had an initial Expression that wasn't using let/var, this adds a
let
to itI also noticed that this module uses var instead of let/const. I saw in another issue,#28009 (comment) , the reasoning for why they haven't been updated yet. But since i am touching this file, I would like to try to do the conversion for this file. If someone else agrees i can push another commit with those updates, if not, then i'll just keep this PR as is
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes