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
test: scope redeclared variable#4854
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
Conversation
Trott commented Jan 25, 2016
cjihrig commented Jan 25, 2016
LGTM One thing we might want to consider while moving forward with block scoping is that we don't need to use IIFEs. The changes in this PR could just be wrapped in curly braces and create a new block scope. |
silverwind commented Jan 25, 2016
targos commented Jan 25, 2016
@silverwind It is already supported in strict mode. |
silverwind commented Jan 25, 2016
Oh, I never knew, thanks! |
cjihrig commented Jan 25, 2016
@silverwind I think it's just part of the definition of block scope. It works at least back to io.js v1.0.0. |
silverwind commented Jan 25, 2016
So called standalone blocks seem to have been around since JavaScript 1.0 according to MDN. It's the combination of strict mode creating a scope on them and block scoped vars that makes them useful now. |
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it.
7cb700f to 73bb5bbCompareTrott commented Jan 25, 2016
I sure like the idea of not having the creation of a function as unnecessary overhead. Converted to block scope, force pushed, looks good. |
silverwind commented Jan 25, 2016
LGTM |
1 similar comment
targos commented Jan 25, 2016
LGTM |
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: nodejs#4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
Trott commented Jan 26, 2016
Landed in 34daaa7 |
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: nodejs#4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
jasnell commented Jan 27, 2016
Added the lts-watch-v4.x label. For commits like this, getting them on the lts-watch list for v4.x helps significantly when determining which commits need to be cherry picked. We cherry pick almost all the test commits unless they specifically relate to semver-minor/major updates. |
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: nodejs#4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
test-assert.jsredeclares a variable withvar. This change convertsit to a
constdeclaration and wraps it in an IIFE to scope it to justthe test that uses it.