Browse Source
test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.
This change applies that rule to instances in the code base that don't
comply with that practice.
This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.
PR-URL: https://github.com/nodejs/node/pull/9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
v4.x
Rich Trott
9 years ago
committed by
Myles Borins
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946
11 changed files with
17 additions and
17 deletions
lib/_stream_wrap.js
lib/_stream_writable.js
lib/_tls_legacy.js
lib/_tls_wrap.js
lib/domain.js
lib/fs.js
lib/net.js
test/parallel/test-child-process-spawn-typeerror.js
test/parallel/test-http-client-readable.js
test/parallel/test-repl-persistent-history.js
test/pummel/test-tls-server-large-request.js
@ -159,7 +159,7 @@ function QueueItem(type, req) {
this . next = this ;
this . next = this ;
}
}
StreamWrap . prototype . _ enqueue = function enqueue ( type , req ) {
StreamWrap . prototype . _ enqueue = function _ enqueue ( type , req ) {
const item = new QueueItem ( type , req ) ;
const item = new QueueItem ( type , req ) ;
if ( this . _ list === null ) {
if ( this . _ list === null ) {
this . _ list = item ;
this . _ list = item ;
@ -174,7 +174,7 @@ StreamWrap.prototype._enqueue = function enqueue(type, req) {
return item ;
return item ;
} ;
} ;
StreamWrap . prototype . _ dequeue = function dequeue ( item ) {
StreamWrap . prototype . _ dequeue = function _ dequeue ( item ) {
assert ( item instanceof QueueItem ) ;
assert ( item instanceof QueueItem ) ;
var next = item . next ;
var next = item . next ;
@ -118,7 +118,7 @@ function WritableState(options, stream) {
this . corkedRequestsFree = new CorkedRequest ( this ) ;
this . corkedRequestsFree = new CorkedRequest ( this ) ;
}
}
WritableState . prototype . getBuffer = function writableStateG etBuffer( ) {
WritableState . prototype . getBuffer = function g etBuffer( ) {
var current = this . bufferedRequest ;
var current = this . bufferedRequest ;
var out = [ ] ;
var out = [ ] ;
while ( current ) {
while ( current ) {
@ -142,7 +142,7 @@ CryptoStream.prototype.init = function init() {
} ;
} ;
CryptoStream . prototype . _ write = function write ( data , encoding , cb ) {
CryptoStream . prototype . _ write = function _ write ( data , encoding , cb ) {
assert ( this . _ pending === null ) ;
assert ( this . _ pending === null ) ;
// Black-hole data
// Black-hole data
@ -223,7 +223,7 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
} ;
} ;
CryptoStream . prototype . _ writePending = function writePending ( ) {
CryptoStream . prototype . _ writePending = function _ writePending ( ) {
const data = this . _ pending ;
const data = this . _ pending ;
const encoding = this . _ pendingEncoding ;
const encoding = this . _ pendingEncoding ;
const cb = this . _ pendingCallback ;
const cb = this . _ pendingCallback ;
@ -235,7 +235,7 @@ CryptoStream.prototype._writePending = function writePending() {
} ;
} ;
CryptoStream . prototype . _ read = function read ( size ) {
CryptoStream . prototype . _ read = function _ read ( size ) {
// XXX: EOF?!
// XXX: EOF?!
if ( ! this . pair . ssl ) return this . push ( null ) ;
if ( ! this . pair . ssl ) return this . push ( null ) ;
@ -316,7 +316,7 @@ proxiedMethods.forEach(function(name) {
} ;
} ;
} ) ;
} ) ;
tls_wrap . TLSWrap . prototype . close = function closeProxy ( cb ) {
tls_wrap . TLSWrap . prototype . close = function close ( cb ) {
let ssl ;
let ssl ;
if ( this . owner ) {
if ( this . owner ) {
ssl = this . owner . ssl ;
ssl = this . owner . ssl ;
@ -369,10 +369,10 @@ TLSSocket.prototype._wrapHandle = function(wrap) {
res . _ secureContext = context ;
res . _ secureContext = context ;
res . reading = handle . reading ;
res . reading = handle . reading ;
Object . defineProperty ( handle , 'reading' , {
Object . defineProperty ( handle , 'reading' , {
get : function readin gG etter ( ) {
get : function get ( ) {
return res . reading ;
return res . reading ;
} ,
} ,
set : function readingSetter ( value ) {
set : function set ( value ) {
res . reading = value ;
res . reading = value ;
}
}
} ) ;
} ) ;
@ -58,7 +58,7 @@ Domain.prototype._disposed = undefined;
// Called by process._fatalException in case an error was thrown.
// Called by process._fatalException in case an error was thrown.
Domain . prototype . _ errorHandler = function errorHandler ( er ) {
Domain . prototype . _ errorHandler = function _ errorHandler ( er ) {
var caught = false ;
var caught = false ;
var self = this ;
var self = this ;
@ -697,7 +697,7 @@ fs.truncate = function(path, len, callback) {
fs . open ( path , 'r+' , function ( er , fd ) {
fs . open ( path , 'r+' , function ( er , fd ) {
if ( er ) return callback ( er ) ;
if ( er ) return callback ( er ) ;
var req = new FSReqWrap ( ) ;
var req = new FSReqWrap ( ) ;
req . oncomplete = function ftruncateCb ( er ) {
req . oncomplete = function oncomplete ( er ) {
fs . close ( fd , function ( er2 ) {
fs . close ( fd , function ( er2 ) {
callback ( er || er2 ) ;
callback ( er || er2 ) ;
} ) ;
} ) ;
@ -189,7 +189,7 @@ function Socket(options) {
}
}
util . inherits ( Socket , stream . Duplex ) ;
util . inherits ( Socket , stream . Duplex ) ;
Socket . prototype . _ unrefTimer = function unrefTimer ( ) {
Socket . prototype . _ unrefTimer = function _ unrefTimer ( ) {
for ( var s = this ; s !== null ; s = s . _ parent )
for ( var s = this ; s !== null ; s = s . _ parent )
timers . _ unrefActive ( s ) ;
timers . _ unrefActive ( s ) ;
} ;
} ;
@ -57,7 +57,7 @@ assert.throws(function() {
// Argument types for combinatorics
// Argument types for combinatorics
const a = [ ] ;
const a = [ ] ;
const o = { } ;
const o = { } ;
const c = function callback ( ) { } ;
const c = function c ( ) { } ;
const s = 'string' ;
const s = 'string' ;
const u = undefined ;
const u = undefined ;
const n = null ;
const n = null ;
@ -15,7 +15,7 @@ FakeAgent.prototype.createConnection = function createConnection() {
var s = new Duplex ( ) ;
var s = new Duplex ( ) ;
var once = false ;
var once = false ;
s . _ read = function read ( ) {
s . _ read = function _ read ( ) {
if ( once )
if ( once )
return this . push ( null ) ;
return this . push ( null ) ;
once = true ;
once = true ;
@ -27,7 +27,7 @@ FakeAgent.prototype.createConnection = function createConnection() {
} ;
} ;
// Blackhole
// Blackhole
s . _ write = function write ( data , enc , cb ) {
s . _ write = function _ write ( data , enc , cb ) {
cb ( ) ;
cb ( ) ;
} ;
} ;
@ -176,7 +176,7 @@ const tests = [
expected : [ prompt , replFailedRead , prompt , replDisabled , prompt ]
expected : [ prompt , replFailedRead , prompt , replDisabled , prompt ]
} ,
} ,
{ // Make sure this is always the last test, since we change os.homedir()
{ // Make sure this is always the last test, since we change os.homedir()
before : function mockHomedirFailu re( ) {
before : function befo re( ) {
// Mock os.homedir() failure
// Mock os.homedir() failure
os . homedir = function ( ) {
os . homedir = function ( ) {
throw new Error ( 'os.homedir() failure' ) ;
throw new Error ( 'os.homedir() failure' ) ;
@ -27,7 +27,7 @@ function Mediator() {
}
}
util . inherits ( Mediator , stream . Writable ) ;
util . inherits ( Mediator , stream . Writable ) ;
Mediator . prototype . _ write = function write ( data , enc , cb ) {
Mediator . prototype . _ write = function _ write ( data , enc , cb ) {
this . buf += data ;
this . buf += data ;
setTimeout ( cb , 0 ) ;
setTimeout ( cb , 0 ) ;