Browse Source

dgram: scope redeclared variables

A few variables in `lib/dgram.js` are redeclared with `var` in a scope
where they have already been declared. These instances can be scoped
more narrowly with `const`, so that's what this change does.

PR-URL: https://github.com/nodejs/node/pull/4940
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
process-exit-stdio-flushing
Rich Trott 9 years ago
parent
commit
1800bf4142
  1. 8
      lib/dgram.js

8
lib/dgram.js

@ -40,13 +40,13 @@ function lookup6(address, callback) {
function newHandle(type) { function newHandle(type) {
if (type == 'udp4') { if (type == 'udp4') {
var handle = new UDP(); const handle = new UDP();
handle.lookup = lookup4; handle.lookup = lookup4;
return handle; return handle;
} }
if (type == 'udp6') { if (type == 'udp6') {
var handle = new UDP(); const handle = new UDP();
handle.lookup = lookup6; handle.lookup = lookup6;
handle.bind = handle.bind6; handle.bind = handle.bind6;
handle.send = handle.send6; handle.send = handle.send6;
@ -209,7 +209,7 @@ Socket.prototype.bind = function(port_ /*, address, callback*/) {
if (!self._handle) if (!self._handle)
return; // handle has been closed in the mean time return; // handle has been closed in the mean time
var err = self._handle.bind(ip, port || 0, flags); const err = self._handle.bind(ip, port || 0, flags);
if (err) { if (err) {
var ex = exceptionWithHostPort(err, 'bind', ip, port); var ex = exceptionWithHostPort(err, 'bind', ip, port);
self.emit('error', ex); self.emit('error', ex);
@ -371,7 +371,7 @@ function doSend(ex, self, ip, buffer, address, port, callback) {
!!callback); !!callback);
if (err && callback) { if (err && callback) {
// don't emit as error, dgram_legacy.js compatibility // don't emit as error, dgram_legacy.js compatibility
var ex = exceptionWithHostPort(err, 'send', address, port); const ex = exceptionWithHostPort(err, 'send', address, port);
process.nextTick(callback, ex); process.nextTick(callback, ex);
} }
} }

Loading…
Cancel
Save