Skip to content
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

tls: scope loop vars with let #4853

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Jan 25, 2016

lib/_tls_common.js had instances of for loops that defined variables
with var such that they were re-declared in the same scope. This
change scopes those variables with let so that they are not
re-declared.

`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.
@Trott Trott added the tls Issues and PRs related to the tls subsystem. label Jan 25, 2016
@ChALkeR
Copy link
Member

ChALkeR commented Jan 25, 2016

Why wasn't this catched by the linter?

@Trott
Copy link
Member Author

Trott commented Jan 25, 2016

@ChALkeR We don't (yet) have the no-redeclare rule turned on.

In the current code base, that rule fires 227 times.

While that may or may not be an acceptable amount of churn for enabling the rule, I'm not so sure that the fixes don't require some examination and thought for each one. It's not always as simple as "oh, just change it from var to const" or "declare it once at the top" or whatever. Or at least sometimes "declare it once at the top" isn't always the best solution. (This change, in this PR, is an example of that, I think. It makes sense for the variables to be scoped and not hoisted here.) So, I'm doing little digestible bits and pieces.

@Trott
Copy link
Member Author

Trott commented Jan 25, 2016

@ChALkeR If it's useful at all, here's the results of turning on no-redeclare on current master: https://gist.github.com/Trott/7dc16adf550b6a8d06cc

@Trott
Copy link
Member Author

Trott commented Jan 25, 2016

@ChALkeR
Copy link
Member

ChALkeR commented Jan 25, 2016

@Trott Ah, thanks!

@cjihrig
Copy link
Contributor

cjihrig commented Jan 25, 2016

LGTM

@silverwind
Copy link
Contributor

LGTM, also cancelled that stuck CI job.

silverwind pushed a commit that referenced this pull request Jan 26, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
@silverwind
Copy link
Contributor

Thanks! Landed in 6a73dba.

@silverwind silverwind closed this Jan 26, 2016
rvagg pushed a commit that referenced this pull request Jan 27, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
benjamingr pushed a commit to benjamingr/io.js that referenced this pull request Jan 27, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: nodejs#4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 8, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 17, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 18, 2016
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: #4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: nodejs#4853
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
@Trott Trott deleted the tls-no-redeclare branch January 13, 2022 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants