-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
net: refactor self=this to arrow functions #5857
Conversation
Refactor unused self=this code to code without without this pattern making it more consistent with the rest of our code. PR-URL: Reviewed-By: Reviewed-By:
} | ||
} | ||
|
||
if (this.destroyed) { | ||
debug('already destroyed, fire error callbacks'); | ||
fireErrorCallbacks(); | ||
fireErrorCallbacks.call(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just passing this
to the function and have self
be the parameter name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually probably a better idea. Thanks.
One nit but otherwise LGTM. |
@@ -485,7 +483,7 @@ Socket.prototype._destroy = function(exception, cb) { | |||
// to make it re-entrance safe in case Socket.prototype.destroy() | |||
// is called within callbacks | |||
this.destroyed = true; | |||
fireErrorCallbacks(); | |||
fireErrorCallbacks.call(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Addressed nit, thanks. |
LGTM |
3 similar comments
LGTM |
LGTM |
LGTM |
Refactor unused self=this code to code without without this pattern making it more consistent with the rest of our code. PR-URL: #5857 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Roman Klauke <romankl@users.noreply.github.com>
Landed in a15906c , thanks reviewers :) |
This is not applying cleanly to v5.x. Could you backport it please? |
Refactor unused self=this code to code without without this pattern making it more consistent with the rest of our code. PR-URL: #5857 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Roman Klauke <romankl@users.noreply.github.com>
Affected core subsystem(s)
net
Description of change
Refactor unused
self=this
code to code without without this patternmaking it more consistent with the rest of our code.
There were PRs to do this code-base wide but they all seem to have stalled so I figured I'd do this in the least objectionable way one change at a time.
CI: https://ci.nodejs.org/job/node-test-pull-request/2037/console