fs: make `processReadResult()` and `readSyncRecursive()` private

PR-URL: https://github.com/nodejs/node/pull/58672
Fixes: https://github.com/nodejs/node/issues/58671
Refs: https://github.com/nodejs/node/pull/41439
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
Livia Medeiros 2025-06-15 01:23:47 +08:00 committed by GitHub
parent 0b3fc0d7a8
commit 823ca6991f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -82,7 +82,7 @@ class Dir {
);
if (result !== null) {
this.processReadResult(path, result);
this.#processReadResult(path, result);
if (result.length > 0) {
ArrayPrototypePush(this.#handlerQueue, handler);
}
@ -125,7 +125,7 @@ class Dir {
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
if (maybeSync)
@ -151,10 +151,10 @@ class Dir {
}
try {
this.processReadResult(this.#path, result);
this.#processReadResult(this.#path, result);
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
callback(null, dirent);
} catch (error) {
@ -170,7 +170,7 @@ class Dir {
);
}
processReadResult(path, result) {
#processReadResult(path, result) {
for (let i = 0; i < result.length; i += 2) {
ArrayPrototypePush(
this.#bufferedEntries,
@ -183,7 +183,7 @@ class Dir {
}
}
readSyncRecursive(dirent) {
#readSyncRecursive(dirent) {
const path = pathModule.join(dirent.parentPath, dirent.name);
const handle = dirBinding.opendir(
path,
@ -209,7 +209,7 @@ class Dir {
if (this.#processHandlerQueue()) {
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
return dirent;
}
@ -223,11 +223,11 @@ class Dir {
return result;
}
this.processReadResult(this.#path, result);
this.#processReadResult(this.#path, result);
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
return dirent;
}