From 9b34b7ed1862c4b7bd84d52cd3417f5a1592efc4 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sun, 7 Apr 2024 17:46:39 +1000 Subject: [PATCH] FUTURE(ext/fs): remove `Deno.FsWatcher.prototype.rid` (#23234) --- runtime/js/40_fs_events.js | 7 +++++++ tests/specs/future/runtime_api/main.js | 4 ++++ tests/specs/future/runtime_api/main.out | 1 + 3 files changed, 12 insertions(+) diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js index 3493ddcd9e..d7aa5de05c 100644 --- a/runtime/js/40_fs_events.js +++ b/runtime/js/40_fs_events.js @@ -11,6 +11,7 @@ const { ObjectPrototypeIsPrototypeOf, PromiseResolve, SymbolAsyncIterator, + ObjectDefineProperty, } = primordials; import { SymbolDispose } from "ext:deno_web/00_infra.js"; @@ -20,6 +21,12 @@ class FsWatcher { #promise; constructor(paths, options) { + if (internals.future) { + ObjectDefineProperty(this, "rid", { + enumerable: false, + value: undefined, + }); + } const { recursive } = options; this.#rid = op_fs_events_open({ recursive, paths }); } diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 9d3b3ed6ce..db8e5fba8a 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -31,6 +31,10 @@ console.log("Deno.writeAllSync is", Deno.writeAllSync); console.log("Deno.write is", Deno.write); console.log("Deno.writeSync is", Deno.writeSync); +const watcher = Deno.watchFs("."); +console.log("Deno.FsWatcher.prototype.rid is", watcher.rid); +watcher.close(); + try { new Deno.FsFile(0); } catch (error) { diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index 595ffd4a4a..252e335123 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -27,4 +27,5 @@ Deno.writeAll is undefined Deno.writeAllSync is undefined Deno.write is undefined Deno.writeSync is undefined +Deno.FsWatcher.prototype.rid is undefined Deno.FsFile constructor is illegal