mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
Preserve filesystem options getter evaluation and record fixture baselines
This commit is contained in:
@@ -7813,6 +7813,30 @@
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/corpus/3134-fs-vectors.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/corpus/3134-fs-vectors.ts"
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/corpus/3135-fs-file-handle-controls.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/corpus/3135-fs-file-handle-controls.ts"
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/corpus/3136-fs-file-handle-options.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/corpus/3136-fs-file-handle-options.ts"
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/corpus/3137-fs-vector-callbacks.cjs": {
|
||||
"order": [
|
||||
"<repo>/tests/corpus/3137-fs-vector-callbacks.cjs"
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/corpus/400-fib.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/corpus/400-fib.ts"
|
||||
@@ -12959,6 +12983,12 @@
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/fixtures/npm/cases/node24-fs-descriptors/main.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/fixtures/npm/cases/node24-fs-descriptors/main.ts"
|
||||
],
|
||||
"diags": []
|
||||
},
|
||||
"<repo>/tests/fixtures/npm/cases/npm-reexport/main.ts": {
|
||||
"order": [
|
||||
"<repo>/tests/fixtures/npm/cases/npm-reexport/facade.ts",
|
||||
|
||||
@@ -4245,7 +4245,7 @@ static const char isl_modules_bootstrap[] =
|
||||
" const readSync = function(fd, buffer, offset, length, position) {\n"
|
||||
" viewOf(buffer);\n"
|
||||
" if (arguments.length <= 3 || typeof offset === 'object') {\n"
|
||||
" const o = optionsOf(offset); offset = o.offset === undefined ? 0 : o.offset; length = o.length === undefined ? buffer.byteLength - offset : o.length; position = o.position;\n"
|
||||
" ({ offset = 0, length = buffer.byteLength - offset, position = null } = optionsOf(offset));\n"
|
||||
" }\n"
|
||||
" const a = readWindow(buffer, offset, length, position, false);\n"
|
||||
" if (a[2] === 0) return 0;\n"
|
||||
@@ -4307,9 +4307,9 @@ static const char isl_modules_bootstrap[] =
|
||||
" if (arguments.length <= 4) {\n"
|
||||
" let o;\n"
|
||||
" if (arguments.length === 4) { o = optionsOf(offset); cb = length; }\n"
|
||||
" else if (arguments.length === 3) { cb = offset; if (!ArrayBuffer.isView(buffer)) { o = optionsOf(buffer); buffer = o.buffer === undefined ? Buffer.alloc(16384) : o.buffer; } }\n"
|
||||
" else if (arguments.length === 3) { cb = offset; if (!ArrayBuffer.isView(buffer)) { o = optionsOf(buffer); ({ buffer = Buffer.alloc(16384) } = o); } }\n"
|
||||
" else { cb = buffer; buffer = Buffer.alloc(16384); }\n"
|
||||
" o = o || {}; offset = o.offset === undefined ? 0 : o.offset; length = o.length === undefined ? buffer.byteLength - offset : o.length; position = o.position;\n"
|
||||
" ({ offset = 0, length = buffer.byteLength - offset, position = null } = o || {});\n"
|
||||
" }\n"
|
||||
" viewOf(buffer); cbOf(cb);\n"
|
||||
" const a = readWindow(buffer, offset, length, position, true);\n"
|
||||
@@ -4353,8 +4353,8 @@ static const char isl_modules_bootstrap[] =
|
||||
" }\n"
|
||||
" read(buffer, offset, length, position) {\n"
|
||||
" return this._call('read', (fd) => {\n"
|
||||
" if (!ArrayBuffer.isView(buffer)) { const o = optionsOf(buffer); buffer = o.buffer === undefined ? Buffer.alloc(16384) : o.buffer; offset = o.offset; length = o.length; position = o.position; }\n"
|
||||
" else if (offset !== null && typeof offset === 'object') { const o = optionsOf(offset); offset = o.offset; length = o.length; position = o.position; }\n"
|
||||
" if (!ArrayBuffer.isView(buffer)) { ({ buffer = Buffer.alloc(16384), offset = 0, length = buffer.byteLength - offset, position = null } = optionsOf(buffer)); }\n"
|
||||
" if (offset !== null && typeof offset === 'object') { ({ offset = 0, length = buffer.byteLength - offset, position = null } = optionsOf(offset)); }\n"
|
||||
" if (offset == null) offset = 0;\n"
|
||||
" if (length == null) length = buffer.byteLength - offset;\n"
|
||||
" const a = readWindow(buffer, offset, length, position, true, false);\n"
|
||||
|
||||
+14
@@ -22,6 +22,14 @@ export async function report() {
|
||||
log("string", fs.writeSync(fd, "616263646566", 0, "hex"));
|
||||
const buffer = Buffer.alloc(5, 46);
|
||||
log("read options", fs.readSync(fd, buffer, { offset: 1, length: 3, position: 2n }), buffer.toString());
|
||||
let getterOrder = "";
|
||||
const getterOptions = () => ({
|
||||
get buffer() { getterOrder += "b"; return buffer; },
|
||||
get offset() { getterOrder += "o"; return 1; },
|
||||
get length() { getterOrder += "l"; return 2; },
|
||||
get position() { getterOrder += "p"; return 0; },
|
||||
});
|
||||
log("sync getters", fs.readSync(fd, buffer, getterOptions()), getterOrder);
|
||||
const backing = new ArrayBuffer(8);
|
||||
const view = new DataView(backing, 2, 3);
|
||||
log("view read", fs.readSync(fd, view, { position: 1 }), Buffer.from(backing).toString("hex"));
|
||||
@@ -57,6 +65,9 @@ export async function report() {
|
||||
});
|
||||
const allocated = await cbIO((cb) => fs.read(fd, { length: 3, position: 1 }, cb));
|
||||
log("callback allocated", allocated[0], allocated[1].length, allocated[1].subarray(0, allocated[0]).toString());
|
||||
getterOrder = "";
|
||||
const callbackGetters = await cbIO((cb) => fs.read(fd, getterOptions(), cb));
|
||||
log("callback getters", callbackGetters[0], callbackGetters[1] === buffer, getterOrder);
|
||||
const shorthand = await cbIO((cb) => fs.read(fd, cb));
|
||||
log("callback default", shorthand[0], shorthand[1].length);
|
||||
const cbWriteBuffer = Buffer.from("WX");
|
||||
@@ -92,6 +103,9 @@ export async function report() {
|
||||
log("handle read", read.bytesRead, read.buffer === dst, Object.getPrototypeOf(read) === null, Buffer.from(dst.buffer).toString("hex"));
|
||||
const defaultRead = await handle.read({ position: 0, length: 3 });
|
||||
log("handle allocated", defaultRead.buffer.length, defaultRead.buffer.subarray(0, defaultRead.bytesRead).toString());
|
||||
getterOrder = "";
|
||||
const handleGetters = await handle.read(getterOptions());
|
||||
log("handle getters", handleGetters.bytesRead, handleGetters.buffer === buffer, getterOrder);
|
||||
const hv = [Buffer.alloc(3), Buffer.alloc(10, 46)];
|
||||
const vr = await handle.readv(hv, 0); log("handle readv", vr.bytesRead, vr.buffers === hv, Object.getPrototypeOf(vr) === null, hv[0].toString(), hv[1].toString());
|
||||
const vw = await handle.writev([Buffer.from("AB"), Buffer.from("CD")], 1); log("handle writev", vw.bytesWritten);
|
||||
|
||||
Reference in New Issue
Block a user