benchmark,doc,lib,test: prepare for padding lint rule

Upcoming lint rule will require a blank line between consecutive
functions. Add it in the places where we don't have it already.

PR-URL: https://github.com/nodejs/node/pull/30696
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Rich Trott 2019-11-27 22:56:21 -08:00
parent 2070d3f8eb
commit 359766b2c3
26 changed files with 43 additions and 0 deletions

View File

@ -13,16 +13,19 @@ function main({ n }) {
if (j === n)
bench.end(n);
}
function cb2(arg1, arg2) {
j++;
if (j === n)
bench.end(n);
}
function cb3(arg1, arg2, arg3) {
j++;
if (j === n)
bench.end(n);
}
function cb4(arg1, arg2, arg3, arg4) {
j++;
if (j === n)

View File

@ -20,6 +20,7 @@ function main({ n }) {
} else
bench.end(n);
}
function cb3(arg1, arg2, arg3) {
if (--counter) {
if (counter % 4 === 0)
@ -33,6 +34,7 @@ function main({ n }) {
} else
bench.end(n);
}
function cb2(arg1, arg2) {
if (--counter) {
if (counter % 4 === 0)
@ -46,6 +48,7 @@ function main({ n }) {
} else
bench.end(n);
}
function cb1(arg1) {
if (--counter) {
if (counter % 4 === 0)

View File

@ -12,7 +12,9 @@ function main({ n }) {
});
function cb1(arg1) {}
function cb2(arg1, arg2) {}
function cb3(arg1, arg2, arg3) {}
bench.start();

View File

@ -21,6 +21,7 @@ function main({ n }) {
setImmediate(cb1, n);
}
}
function cb2(n, arg2) {
if (--n) {
if (n % 3 === 0)
@ -31,6 +32,7 @@ function main({ n }) {
setImmediate(cb1, n);
}
}
function cb1(n) {
if (--n) {
if (n % 3 === 0)

View File

@ -12,16 +12,19 @@ function main({ n }) {
if (j === n)
bench.end(n);
}
function cb2(arg1, arg2) {
j++;
if (j === n)
bench.end(n);
}
function cb3(arg1, arg2, arg3) {
j++;
if (j === n)
bench.end(n);
}
function cb4(arg1, arg2, arg3, arg4) {
j++;
if (j === n)

View File

@ -19,9 +19,11 @@ function main({ n }) {
function cb() {
process.nextTick(counter);
}
function cb2() {
process.nextTick(counter);
}
function counter() {
count++;
if (count === n)

View File

@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}
function cb2() {
count++;
if (count === n)

View File

@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}
function cb2() {
count++;
if (count === n)

View File

@ -1266,9 +1266,11 @@ a string as the second argument gets considered:
function throwingFirst() {
throw new Error('First');
}
function throwingSecond() {
throw new Error('Second');
}
function notThrowing() {}
// The second argument is a string and the input function threw an Error.

View File

@ -646,6 +646,7 @@ function needFinish(state) {
!state.finished &&
!state.writing);
}
function callFinal(stream, state) {
stream._final((err) => {
state.pendingcb--;
@ -658,6 +659,7 @@ function callFinal(stream, state) {
}
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === 'function' && !state.destroyed) {
@ -736,6 +738,7 @@ function onFinished(stream, state, cb) {
stream.emit('error', err);
}
}
function onfinish() {
stream.removeListener('finish', onfinish);
stream.removeListener('error', onerror);

View File

@ -7,6 +7,7 @@ function lazyError() {
}
return error;
}
function assert(value, message) {
if (!value) {
const ERR_INTERNAL_ASSERTION = lazyError();

View File

@ -14,9 +14,13 @@ const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest');
const kPendingShutdownRequest = Symbol('kPendingShutdownRequest');
function isClosing() { return this[owner_symbol].isClosing(); }
function onreadstart() { return this[owner_symbol].readStart(); }
function onreadstop() { return this[owner_symbol].readStop(); }
function onshutdown(req) { return this[owner_symbol].doShutdown(req); }
function onwrite(req, bufs) { return this[owner_symbol].doWrite(req, bufs); }
/* This class serves as a wrapper for when the C++ side of Node wants access

View File

@ -49,6 +49,7 @@ const kHasTickScheduled = 0;
function hasTickScheduled() {
return tickInfo[kHasTickScheduled] === 1;
}
function setHasTickScheduled(value) {
tickInfo[kHasTickScheduled] = value ? 1 : 0;
}

View File

@ -16,6 +16,7 @@ function lazyWorkerStdio() {
if (!workerStdio) workerStdio = createWorkerStdio();
return workerStdio;
}
function createStdioGetters() {
return {
getStdout() { return lazyWorkerStdio().stdout; },

View File

@ -273,6 +273,7 @@ function REPLServer(prompt,
function pause() {
paused = true;
}
function unpause() {
if (!paused) return;
paused = false;

View File

@ -4,6 +4,7 @@ const assert = require('assert');
function createURL(mime, body) {
return `data:${mime},${body}`;
}
function createBase64URL(mime, body) {
return `data:${mime};base64,${Buffer.from(body).toString('base64')}`;
}

View File

@ -26,10 +26,13 @@ const assert = require('assert');
const events = require('events');
function listener() {}
function listener2() {}
function listener3() {
return 0;
}
function listener4() {
return 1;
}

View File

@ -25,6 +25,7 @@ const assert = require('assert');
const EventEmitter = require('events');
function listener1() {}
function listener2() {}
{

View File

@ -490,6 +490,7 @@ function test_abs_with_kids(realpath, realpathSync, cb) {
try { fs.rmdirSync(root + folder); } catch {}
});
}
function setup() {
cleanup();
['',

View File

@ -27,6 +27,7 @@ function asyncLoop(fn, times, cb) {
}
});
}
function makeKeepAliveRequest(cb) {
http.get({
socketPath: common.PIPE,

View File

@ -62,6 +62,7 @@ assert.strictEqual(r1.useColors, r1.rli.terminal);
// 2
function writer() {}
function evaler() {}
const r2 = repl.start({
input: stream,

View File

@ -12,6 +12,7 @@ const expected = 'asdf';
function _transform(d, e, n) {
n();
}
function _flush(n) {
n(null, expected);
}

View File

@ -68,6 +68,7 @@ server.listen(0, function() {
process.exit(0);
write();
}
function write() {
// This needs to return false eventually
while (false !== conn.write(chunk));

View File

@ -26,6 +26,7 @@ const stat = promisify(fs.stat);
{
function fn() {}
function promisifedFn() {}
fn[promisify.custom] = promisifedFn;
assert.strictEqual(promisify(fn), promisifedFn);

View File

@ -86,6 +86,7 @@ assert.throws(
fs.unwatchFile(filepathTwo, a);
++watchSeenTwo;
}
function b() {
fs.unwatchFile(filepathTwo, b);
++watchSeenTwo;

View File

@ -205,6 +205,7 @@ function testRunnerMain() {
});
});
}
function masterProcessMain() {
const workers = JSON.parse(process.env.workers);
const clusterSettings = JSON.parse(process.env.clusterSettings) || {};