Skip to content

Commit fc111c7

Browse files
committed
vfs: drop comments that restate the code
The previous commit added comments that narrate what the adjacent code does. Its commit message already carries the reasoning, so remove them. Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
1 parent 13ea60c commit fc111c7

7 files changed

Lines changed: 2 additions & 31 deletions

File tree

‎lib/fs.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,8 +1916,6 @@ function readdirSync(path, options) {
19161916
validateBoolean(options.recursive, 'options.recursive');
19171917
}
19181918

1919-
// After validation, so a mounted path rejects the same bad arguments as
1920-
// a real one.
19211919
const h = vfsState.handlers;
19221920
if (h !== null) {
19231921
const result = h.readdirSync(path, options);
@@ -2710,8 +2708,6 @@ function utimes(path, atime, mtime, callback) {
27102708
*/
27112709
function utimesSync(path, atime, mtime) {
27122710
path = getValidatedPath(path);
2713-
// Converted before the VFS hook so a mounted path gets the same
2714-
// validation and the same seconds-since-epoch numbers as a real one.
27152711
atime = toUnixTimestamp(atime);
27162712
mtime = toUnixTimestamp(mtime);
27172713

‎lib/internal/fs/promises.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,8 +1675,6 @@ async function readdir(path, options) {
16751675

16761676
path = getValidatedPath(path);
16771677

1678-
// After validation, so a mounted path rejects the same bad arguments as
1679-
// a real one.
16801678
const h = vfsState.handlers;
16811679
if (h !== null) {
16821680
const promise = h.readdir(path, options);
@@ -1957,8 +1955,6 @@ async function chown(path, uid, gid) {
19571955

19581956
async function utimes(path, atime, mtime) {
19591957
path = getValidatedPath(path);
1960-
// Converted before the VFS hook so a mounted path gets the same
1961-
// validation and the same seconds-since-epoch numbers as a real one.
19621958
atime = toUnixTimestamp(atime);
19631959
mtime = toUnixTimestamp(mtime);
19641960

‎lib/internal/vfs/dir.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ class VirtualDir {
9595
}
9696
}
9797

98-
// Disposal is idempotent, as on the native Dir: a handle that was already
99-
// closed by hand is not an error to dispose again.
10098
async [SymbolAsyncDispose]() {
10199
if (!this.#closed) {
102100
this.closeSync();

‎lib/internal/vfs/file_handle.js‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ class VirtualFileHandle {
243243
}
244244

245245
/**
246-
* Changes the file mode. Providers whose handles carry no metadata leave
247-
* this a no-op; those that do override it.
248246
* @param {number} mode The new permission bits
249247
*/
250248
chmodSync(mode) {}
@@ -264,8 +262,6 @@ class VirtualFileHandle {
264262
async chown() {}
265263

266264
/**
267-
* Changes the timestamps. Providers whose handles carry no metadata leave
268-
* this a no-op; those that do override it.
269265
* @param {Date|number|string} atime The new access time
270266
* @param {Date|number|string} mtime The new modification time
271267
*/
@@ -689,14 +685,10 @@ class MemoryFileHandle extends VirtualFileHandle {
689685
}
690686

691687
/**
692-
* Changes the permission bits of the underlying entry, as fchmod(2) does
693-
* through a descriptor. The type bits are kept.
694688
* @param {number} mode The new permission bits
695689
*/
696690
chmodSync(mode) {
697691
this.#checkClosed('fchmod');
698-
// Validated here as well because a `FileHandle` calls this method
699-
// directly with the caller's argument.
700692
mode = parseFileMode(mode, 'mode');
701693
if (this.#entry) {
702694
this.#entry.mode = (this.#entry.mode & ~0o7777) | (mode & 0o7777);
@@ -705,10 +697,6 @@ class MemoryFileHandle extends VirtualFileHandle {
705697
}
706698

707699
/**
708-
* Changes the timestamps of the underlying entry, as futimes(2) does
709-
* through a descriptor. Accepts what `fs.utimes` accepts; the values are
710-
* validated and converted here because a `FileHandle` calls this method
711-
* directly with the caller's arguments.
712700
* @param {Date|number|string} atime The new access time
713701
* @param {Date|number|string} mtime The new modification time
714702
*/

‎lib/internal/vfs/file_system.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ class VirtualFileSystem {
371371
mkdirSync(dirPath, options) {
372372
const providerPath = this.#toProviderPath(dirPath);
373373
const created = this[kProvider].mkdirSync(providerPath, options);
374-
// A recursive mkdir reports the first directory it created, which the
375-
// provider names relative to itself.
376374
return created === undefined ? undefined : this.#toMountedPath(created);
377375
}
378376

@@ -577,10 +575,8 @@ class VirtualFileSystem {
577575
}
578576

579577
/**
580-
* Converts a mkdtemp prefix to a provider-relative one. The prefix is
581-
* text that the random suffix is appended to, not a path to resolve: a
582-
* trailing separator means "inside this directory", and resolving would
583-
* drop it and turn `dir/` + suffix into a sibling of `dir`.
578+
* Converts a mkdtemp prefix to a provider-relative one, keeping a
579+
* trailing separator.
584580
* @param {string} prefix The mounted prefix
585581
* @returns {string}
586582
*/

‎lib/internal/vfs/setup.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,6 @@ function createVfsHandlers() {
622622
if (pathStr !== null) {
623623
const r = findVFSForPath(pathStr);
624624
if (r !== null) {
625-
// A provider watcher polls whatever it is given; the real fs
626-
// refuses up front when there is nothing to watch.
627625
if (!r.vfs.existsSync(pathStr)) throw createENOENT('watch', pathStr);
628626
return r.vfs.watch(pathStr, options, listener);
629627
}

‎test/parallel/test-vfs-fs-hook-gaps.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,5 @@ test('a closed Dir can be disposed asynchronously', async () => {
107107
const dir = mount((l) => l.mkdirSync('/d'));
108108
const handle = fs.opendirSync(dir);
109109
handle.closeSync();
110-
// Disposal is idempotent on a real Dir.
111110
await handle[Symbol.asyncDispose]();
112111
});

0 commit comments

Comments
 (0)