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

Conversation

Projects
None yet
6 participants
@Trott
Copy link
Member

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.

tls: scope loop vars with let
`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 label Jan 25, 2016

@ChALkeR

This comment has been minimized.

Copy link
Member

commented Jan 25, 2016

Why wasn't this catched by the linter?

@Trott

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

commented Jan 25, 2016

@ChALkeR

This comment has been minimized.

Copy link
Member

commented Jan 25, 2016

@Trott Ah, thanks!

@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2016

LGTM

@silverwind

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

LGTM, also cancelled that stuck CI job.

silverwind added a commit that referenced this pull request Jan 26, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
@silverwind

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

Thanks! Landed in 6a73dba.

@silverwind silverwind closed this Jan 26, 2016

rvagg added a commit that referenced this pull request Jan 27, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

benjamingr added a commit to benjamingr/io.js that referenced this pull request Jan 27, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

rvagg added a commit that referenced this pull request Feb 8, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

MylesBorins added a commit that referenced this pull request Feb 17, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

MylesBorins added a commit that referenced this pull request Feb 18, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

@MylesBorins MylesBorins referenced this pull request Feb 18, 2016

Merged

V4.4.0 proposal #5301

MylesBorins added a commit that referenced this pull request Mar 2, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>

scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016

tls: scope loop vars with let
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.