1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

chore: update dlint to v0.37.0 for GitHub Actions (#17295)

Updated third_party dlint to v0.37.0 for GitHub Actions. This PR
includes following changes:
 
* fix(prefer-primordials): Stop using array pattern assignments
* fix(prefer-primordials): Stop using global intrinsics except for
`SharedArrayBuffer`
* feat(guard-for-in): Apply new guard-for-in rule
This commit is contained in:
Kenta Moriuchi 2023-01-17 01:17:18 +09:00 committed by Bartek Iwańczuk
parent 47130f3500
commit 566e30c29d
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750
29 changed files with 128 additions and 103 deletions

View file

@ -3,7 +3,8 @@
"tags": ["recommended"],
"include": [
"ban-untagged-todo",
"camelcase"
"camelcase",
"guard-for-in"
],
"exclude": [
"no-invalid-triple-slash-reference"

View file

@ -26,6 +26,7 @@
MapPrototypeSet,
MathCeil,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ObjectPrototypeIsPrototypeOf,
Promise,
SafeArrayIterator,
@ -167,6 +168,9 @@
const details = [];
for (const key in post.ops) {
if (!ObjectPrototypeHasOwnProperty(post.ops, key)) {
continue;
}
const preOp = pre.ops[key] ??
{ opsDispatchedAsync: 0, opsCompletedAsync: 0 };
const postOp = post.ops[key];

View file

@ -34,52 +34,52 @@ const headerDict: Record<string, string> = {
};
// deno-lint-ignore no-explicit-any
const headerSeq: any[] = [];
for (const name in headerDict) {
headerSeq.push([name, headerDict[name]]);
for (const [name, value] of Object.entries(headerDict)) {
headerSeq.push([name, value]);
}
Deno.test(function newHeaderWithSequence() {
const headers = new Headers(headerSeq);
for (const name in headerDict) {
assertEquals(headers.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
assertEquals(headers.get(name), String(value));
}
assertEquals(headers.get("length"), null);
});
Deno.test(function newHeaderWithRecord() {
const headers = new Headers(headerDict);
for (const name in headerDict) {
assertEquals(headers.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
assertEquals(headers.get(name), String(value));
}
});
Deno.test(function newHeaderWithHeadersInstance() {
const headers = new Headers(headerDict);
const headers2 = new Headers(headers);
for (const name in headerDict) {
assertEquals(headers2.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
assertEquals(headers2.get(name), String(value));
}
});
Deno.test(function headerAppendSuccess() {
const headers = new Headers();
for (const name in headerDict) {
headers.append(name, headerDict[name]);
assertEquals(headers.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
headers.append(name, value);
assertEquals(headers.get(name), String(value));
}
});
Deno.test(function headerSetSuccess() {
const headers = new Headers();
for (const name in headerDict) {
headers.set(name, headerDict[name]);
assertEquals(headers.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
headers.set(name, value);
assertEquals(headers.get(name), String(value));
}
});
Deno.test(function headerHasSuccess() {
const headers = new Headers(headerDict);
for (const name in headerDict) {
for (const name of Object.keys(headerDict)) {
assert(headers.has(name), "headers has name " + name);
assert(
!headers.has("nameNotInHeaders"),
@ -90,7 +90,7 @@ Deno.test(function headerHasSuccess() {
Deno.test(function headerDeleteSuccess() {
const headers = new Headers(headerDict);
for (const name in headerDict) {
for (const name of Object.keys(headerDict)) {
assert(headers.has(name), "headers have a header: " + name);
headers.delete(name);
assert(!headers.has(name), "headers do not have anymore a header: " + name);
@ -99,8 +99,8 @@ Deno.test(function headerDeleteSuccess() {
Deno.test(function headerGetSuccess() {
const headers = new Headers(headerDict);
for (const name in headerDict) {
assertEquals(headers.get(name), String(headerDict[name]));
for (const [name, value] of Object.entries(headerDict)) {
assertEquals(headers.get(name), String(value));
assertEquals(headers.get("nameNotInHeaders"), null);
}
});

View file

@ -34,7 +34,7 @@
break;
}
const [name, data] = message;
const { 0: name, 1: data } = message;
dispatch(null, name, new Uint8Array(data));
}

View file

@ -255,7 +255,7 @@
},
);
if (matchResult) {
const [meta, responseBodyRid] = matchResult;
const { 0: meta, 1: responseBodyRid } = matchResult;
let body = null;
if (responseBodyRid !== null) {
body = readableStreamForRid(responseBodyRid);

View file

@ -360,7 +360,7 @@
ObjectKeys(value).length > 0 ||
ObjectGetOwnPropertySymbols(value).length > 0
) {
const [propString, refIndex] = inspectRawObject(
const { 0: propString, 1: refIndex } = inspectRawObject(
value,
inspectOptions,
);
@ -847,7 +847,7 @@
displayName: "",
delims: ["[", "]"],
entryHandler: (entry, inspectOptions) => {
const [index, val] = entry;
const { 0: index, 1: val } = entry;
let i = index;
lastValidIndex = index;
if (!ObjectPrototypeHasOwnProperty(value, i)) {
@ -940,7 +940,7 @@
displayName: "Map",
delims: ["{", "}"],
entryHandler: (entry, inspectOptions) => {
const [key, val] = entry;
const { 0: key, 1: val } = entry;
inspectOptions.indentLevel++;
const inspectedValue = `${
inspectValueWithQuotes(key, inspectOptions)
@ -1100,7 +1100,7 @@
const cyan = maybeColor(colors.cyan, inspectOptions);
const red = maybeColor(colors.red, inspectOptions);
const [state, result] = core.getPromiseDetails(value);
const { 0: state, 1: result } = core.getPromiseDetails(value);
if (state === PromiseState.Pending) {
return `Promise { ${cyan("<pending>")} }`;
@ -1363,7 +1363,7 @@
);
} else {
// Otherwise, default object formatting
let [insp, refIndex] = inspectRawObject(value, inspectOptions);
let { 0: insp, 1: refIndex } = inspectRawObject(value, inspectOptions);
insp = refIndex + insp;
return insp;
}
@ -1568,17 +1568,17 @@
let g_;
let b_;
if (h < 60) {
[r_, g_, b_] = [c, x, 0];
({ 0: r_, 1: g_, 2: b_ } = [c, x, 0]);
} else if (h < 120) {
[r_, g_, b_] = [x, c, 0];
({ 0: r_, 1: g_, 2: b_ } = [x, c, 0]);
} else if (h < 180) {
[r_, g_, b_] = [0, c, x];
({ 0: r_, 1: g_, 2: b_ } = [0, c, x]);
} else if (h < 240) {
[r_, g_, b_] = [0, x, c];
({ 0: r_, 1: g_, 2: b_ } = [0, x, c]);
} else if (h < 300) {
[r_, g_, b_] = [x, 0, c];
({ 0: r_, 1: g_, 2: b_ } = [x, 0, c]);
} else {
[r_, g_, b_] = [c, 0, x];
({ 0: r_, 1: g_, 2: b_ } = [c, 0, x]);
}
return [
MathRound((r_ + m) * 255),
@ -1645,7 +1645,7 @@
}
for (let i = 0; i < rawEntries.length; ++i) {
const [key, value] = rawEntries[i];
const { 0: key, 1: value } = rawEntries[i];
if (key == "background-color") {
if (value != null) {
css.backgroundColor = value;
@ -1736,12 +1736,12 @@
ansi += `\x1b[47m`;
} else {
if (ArrayIsArray(css.backgroundColor)) {
const [r, g, b] = css.backgroundColor;
const { 0: r, 1: g, 2: b } = css.backgroundColor;
ansi += `\x1b[48;2;${r};${g};${b}m`;
} else {
const parsed = parseCssColor(css.backgroundColor);
if (parsed !== null) {
const [r, g, b] = parsed;
const { 0: r, 1: g, 2: b } = parsed;
ansi += `\x1b[48;2;${r};${g};${b}m`;
} else {
ansi += "\x1b[49m";
@ -1770,12 +1770,12 @@
ansi += `\x1b[37m`;
} else {
if (ArrayIsArray(css.color)) {
const [r, g, b] = css.color;
const { 0: r, 1: g, 2: b } = css.color;
ansi += `\x1b[38;2;${r};${g};${b}m`;
} else {
const parsed = parseCssColor(css.color);
if (parsed !== null) {
const [r, g, b] = parsed;
const { 0: r, 1: g, 2: b } = parsed;
ansi += `\x1b[38;2;${r};${g};${b}m`;
} else {
ansi += "\x1b[39m";
@ -1799,7 +1799,7 @@
}
if (!colorEquals(css.textDecorationColor, prevCss.textDecorationColor)) {
if (css.textDecorationColor != null) {
const [r, g, b] = css.textDecorationColor;
const { 0: r, 1: g, 2: b } = css.textDecorationColor;
ansi += `\x1b[58;2;${r};${g};${b}m`;
} else {
ansi += "\x1b[59m";
@ -2045,7 +2045,7 @@
return;
}
const [first, ...rest] = args;
const [first, ...rest] = new SafeArrayIterator(args);
if (typeof first === "string") {
this.error(

View file

@ -305,7 +305,7 @@
const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`;
// deno-lint-ignore prefer-primordials
for (const [name, value] of formData) {
for (const { 0: name, 1: value } of formData) {
if (typeof value === "string") {
ArrayPrototypePush(
chunks,

View file

@ -42,6 +42,8 @@
JSONParse,
ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
TypedArrayPrototypeSlice,
TypeError,
Uint8Array,
@ -185,7 +187,7 @@
* @returns {InnerBody}
*/
clone() {
const [out1, out2] = this.stream.tee();
const { 0: out1, 1: out2 } = this.stream.tee();
this.streamOrStatic = out1;
const second = new InnerBody(out2);
second.source = core.deserialize(core.serialize(this.source));
@ -447,6 +449,7 @@
if (typeof V === "object") {
if (
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
// deno-lint-ignore prefer-primordials
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
) {
return webidl.converters["ArrayBuffer"](V, opts);

View file

@ -268,7 +268,10 @@
let size = 0;
let alignment = 1;
for (const field of new SafeArrayIterator(type.struct)) {
const [fieldSize, fieldAlign] = getTypeSizeAndAlignment(field, cache);
const { 0: fieldSize, 1: fieldAlign } = getTypeSizeAndAlignment(
field,
cache,
);
alignment = MathMax(alignment, fieldAlign);
size = MathCeil(size / fieldAlign) * fieldAlign;
size += fieldSize;
@ -319,7 +322,7 @@
"Invalid UnsafeCallback, cannot be nonblocking",
);
}
const [rid, pointer] = ops.op_ffi_unsafe_callback_create(
const { 0: rid, 1: pointer } = ops.op_ffi_unsafe_callback_create(
definition,
callback,
);
@ -362,7 +365,7 @@
symbols = {};
constructor(path, symbols) {
[this.#rid, this.symbols] = ops.op_ffi_load({ path, symbols });
({ 0: this.#rid, 1: this.symbols } = ops.op_ffi_load({ path, symbols }));
for (const symbol in symbols) {
if (!ObjectPrototypeHasOwnProperty(symbols, symbol)) {
continue;

View file

@ -140,7 +140,7 @@
// Date header: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2
let str = `HTTP/1.1 ${status} ${statusCodes[status]}\r\nDate: ${date}\r\n`;
for (let i = 0; i < headerList.length; ++i) {
const [name, value] = headerList[i];
const { 0: name, 1: value } = headerList[i];
// header-field = field-name ":" OWS field-value OWS
str += `${name}: ${value}\r\n`;
}

View file

@ -115,7 +115,7 @@
return null;
}
const [streamRid, method, url] = nextRequest;
const { 0: streamRid, 1: method, 2: url } = nextRequest;
SetPrototypeAdd(this.managedResources, streamRid);
/** @type {ReadableStream<Uint8Array> | undefined} */

View file

@ -175,7 +175,7 @@
}
this.#promiseId = promise[promiseIdSymbol];
if (this.#unref) core.unrefOp(this.#promiseId);
const [rid, localAddr, remoteAddr] = await promise;
const { 0: rid, 1: localAddr, 2: remoteAddr } = await promise;
this.#promiseId = null;
if (this.addr.transport == "tcp") {
localAddr.transport = "tcp";
@ -260,21 +260,21 @@
let remoteAddr;
switch (this.addr.transport) {
case "udp": {
[nread, remoteAddr] = await core.opAsync(
({ 0: nread, 1: remoteAddr } = await core.opAsync(
"op_net_recv_udp",
this.rid,
buf,
);
));
remoteAddr.transport = "udp";
break;
}
case "unixpacket": {
let path;
[nread, path] = await core.opAsync(
({ 0: nread, 1: path } = await core.opAsync(
"op_net_recv_unixpacket",
this.rid,
buf,
);
));
remoteAddr = { transport: "unixpacket", path };
break;
}
@ -330,7 +330,7 @@
function listen(args) {
switch (args.transport ?? "tcp") {
case "tcp": {
const [rid, addr] = ops.op_net_listen_tcp({
const { 0: rid, 1: addr } = ops.op_net_listen_tcp({
hostname: args.hostname ?? "0.0.0.0",
port: args.port,
}, args.reusePort);
@ -338,7 +338,7 @@
return new Listener(rid, addr);
}
case "unix": {
const [rid, path] = ops.op_net_listen_unix(args.path);
const { 0: rid, 1: path } = ops.op_net_listen_unix(args.path);
const addr = {
transport: "unix",
path,
@ -354,7 +354,7 @@
return function listenDatagram(args) {
switch (args.transport) {
case "udp": {
const [rid, addr] = udpOpFn(
const { 0: rid, 1: addr } = udpOpFn(
{
hostname: args.hostname ?? "127.0.0.1",
port: args.port,
@ -365,7 +365,7 @@
return new Datagram(rid, addr);
}
case "unixpacket": {
const [rid, path] = unixOpFn(args.path);
const { 0: rid, 1: path } = unixOpFn(args.path);
const addr = {
transport: "unixpacket",
path,
@ -381,7 +381,7 @@
async function connect(args) {
switch (args.transport ?? "tcp") {
case "tcp": {
const [rid, localAddr, remoteAddr] = await core.opAsync(
const { 0: rid, 1: localAddr, 2: remoteAddr } = await core.opAsync(
"op_net_connect_tcp",
{
hostname: args.hostname ?? "127.0.0.1",
@ -393,7 +393,7 @@
return new TcpConn(rid, remoteAddr, localAddr);
}
case "unix": {
const [rid, localAddr, remoteAddr] = await core.opAsync(
const { 0: rid, 1: localAddr, 2: remoteAddr } = await core.opAsync(
"op_net_connect_unix",
args.path,
);

View file

@ -34,7 +34,7 @@
if (transport !== "tcp") {
throw new TypeError(`Unsupported transport: '${transport}'`);
}
const [rid, localAddr, remoteAddr] = await core.opAsync(
const { 0: rid, 1: localAddr, 2: remoteAddr } = await core.opAsync(
"op_net_connect_tls",
{ hostname, port },
{ certFile, caCerts, certChain, privateKey, alpnProtocols },
@ -46,7 +46,7 @@
class TlsListener extends Listener {
async accept() {
const [rid, localAddr, remoteAddr] = await core.opAsync(
const { 0: rid, 1: localAddr, 2: remoteAddr } = await core.opAsync(
"op_net_accept_tls",
this.rid,
);
@ -70,7 +70,7 @@
if (transport !== "tcp") {
throw new TypeError(`Unsupported transport: '${transport}'`);
}
const [rid, localAddr] = ops.op_net_listen_tls(
const { 0: rid, 1: localAddr } = ops.op_net_listen_tls(
{ hostname, port },
{ cert, certFile, key, keyFile, alpnProtocols, reusePort },
);
@ -86,7 +86,7 @@
alpnProtocols = undefined,
} = {},
) {
const [rid, localAddr, remoteAddr] = await opStartTls({
const { 0: rid, 1: localAddr, 2: remoteAddr } = await opStartTls({
rid: conn.rid,
hostname,
certFile,

View file

@ -367,16 +367,16 @@
}
#updateComponents() {
[
this.#schemeEnd,
this.#usernameEnd,
this.#hostStart,
this.#hostEnd,
this.#port,
this.#pathStart,
this.#queryStart,
this.#fragmentStart,
] = componentsBuf;
({
0: this.#schemeEnd,
1: this.#usernameEnd,
2: this.#hostStart,
3: this.#hostEnd,
4: this.#port,
5: this.#pathStart,
6: this.#queryStart,
7: this.#fragmentStart,
} = componentsBuf);
}
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {

View file

@ -155,7 +155,7 @@
return false;
}
const [values] = res;
const values = res[0];
const keys = ObjectKeys(values);
for (let i = 0; i < keys.length; ++i) {
@ -196,7 +196,7 @@
return null;
}
const [values, inputs] = res;
const { 0: values, 1: inputs } = res;
if (inputs[1] === null) {
inputs.pop();
}

View file

@ -193,7 +193,7 @@
DATA_CLONE_ERR,
});
for (let i = 0; i < entries.length; ++i) {
const [key, value] = entries[i];
const { 0: key, 1: value } = entries[i];
const desc = { value, enumerable: true };
ObjectDefineProperty(DOMException, key, desc);
ObjectDefineProperty(DOMException.prototype, key, desc);

View file

@ -23,6 +23,7 @@
BigInt64ArrayPrototype,
BigUint64ArrayPrototype,
DataView,
FinalizationRegistry,
Int8ArrayPrototype,
Int16ArrayPrototype,
Int32ArrayPrototype,
@ -45,7 +46,8 @@
RangeError,
ReflectHas,
SafePromiseAll,
SharedArrayBuffer,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
Symbol,
SymbolAsyncIterator,
SymbolFor,
@ -205,6 +207,7 @@
assert(typeof O === "object");
assert(
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, O) ||
// deno-lint-ignore prefer-primordials
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O),
);
if (isDetachedBuffer(O)) {

View file

@ -18,6 +18,8 @@
const {
PromiseReject,
PromiseResolve,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
StringPrototypeCharCodeAt,
StringPrototypeSlice,
TypedArrayPrototypeSubarray,
@ -108,6 +110,7 @@
// When doing so they will have to make sure that changes to input do not affect future calls to decode().
if (
ObjectPrototypeIsPrototypeOf(
// deno-lint-ignore prefer-primordials
SharedArrayBuffer.prototype,
input || input.buffer,
)

View file

@ -23,10 +23,13 @@
AsyncGeneratorPrototypeNext,
Date,
DatePrototypeGetTime,
FinalizationRegistry,
MathMax,
MathMin,
ObjectPrototypeIsPrototypeOf,
RegExpPrototypeTest,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
StringPrototypeCharAt,
StringPrototypeToLowerCase,
StringPrototypeSlice,
@ -407,6 +410,7 @@
}
if (
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
// deno-lint-ignore prefer-primordials
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
) {
return webidl.converters["ArrayBuffer"](V, opts);

View file

@ -36,7 +36,7 @@
constructor() {
this[webidl.brand] = webidl.brand;
const [port1Id, port2Id] = opCreateEntangledMessagePort();
const { 0: port1Id, 1: port2Id } = opCreateEntangledMessagePort();
const port1 = createMessagePort(port1Id);
const port2 = createMessagePort(port2Id);
this.#port1 = port1;
@ -329,8 +329,7 @@
context: "Argument 2",
});
const messageData = serializeJsMessageData(value, options.transfer);
const [data] = deserializeJsMessageData(messageData);
return data;
return deserializeJsMessageData(messageData)[0];
}
window.__bootstrap.messagePort = {

View file

@ -41,6 +41,7 @@
Uint32Array,
Uint32ArrayPrototype,
Uint8Array,
WeakRef,
} = window.__bootstrap.primordials;
const _rid = Symbol("[[rid]]");
@ -1893,7 +1894,7 @@
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
}
for (let i = 0; i < mappedRanges.length; ++i) {
const [buffer, _rid, start] = mappedRanges[i];
const { 0: buffer, /* 1: rid, */ 2: start } = mappedRanges[i];
// TODO(lucacasonato): is this logic correct?
const end = start + buffer.byteLength;
if (
@ -1962,7 +1963,7 @@
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
}
for (let i = 0; i < mappedRanges.length; ++i) {
const [buffer, mappedRid] = mappedRanges[i];
const { 0: buffer, 1: mappedRid } = mappedRanges[i];
const { err } = ops.op_webgpu_buffer_unmap(
bufferRid,
mappedRid,

View file

@ -70,7 +70,7 @@
SetPrototypeDelete,
SetPrototypeAdd,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBuffer,
// SharedArrayBufferPrototype
String,
StringFromCodePoint,
StringPrototypeCharCodeAt,
@ -447,6 +447,7 @@
}
function isSharedArrayBuffer(V) {
// deno-lint-ignore prefer-primordials
return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V);
}

View file

@ -32,6 +32,8 @@
PromisePrototypeThen,
RegExpPrototypeTest,
Set,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
StringPrototypeEndsWith,
StringPrototypeToLowerCase,
Symbol,
@ -58,9 +60,9 @@
return webidl.converters["Blob"](V, opts);
}
if (typeof V === "object") {
// TODO(littledivy): use primordial for SharedArrayBuffer
if (
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
// deno-lint-ignore prefer-primordials
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
) {
return webidl.converters["ArrayBuffer"](V, opts);

View file

@ -13,7 +13,11 @@
};
function setBuildInfo(target) {
const [arch, vendor, os, env] = StringPrototypeSplit(target, "-", 4);
const { 0: arch, 1: vendor, 2: os, 3: env } = StringPrototypeSplit(
target,
"-",
4,
);
build.target = target;
build.arch = arch;
build.vendor = vendor;

View file

@ -139,7 +139,7 @@
#pollControl = async () => {
while (this.#status === "RUNNING") {
const [type, data] = await hostRecvCtrl(this.#id);
const { 0: type, 1: data } = await hostRecvCtrl(this.#id);
// If terminate was called then we ignore all messages
if (this.#status === "TERMINATED") {

View file

@ -213,7 +213,7 @@
'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux"; return {';
const typeEntries = ObjectEntries(types);
for (let i = 0; i < typeEntries.length; ++i) {
let [name, type] = typeEntries[i];
let { 0: name, 1: type } = typeEntries[i];
const optional = type.startsWith("?");
if (optional) type = type.slice(1);
@ -243,7 +243,7 @@
return [new Function("view", str), new Uint32Array(offset)];
}
const [statStruct, statBuf] = createByteStruct({
const { 0: statStruct, 1: statBuf } = createByteStruct({
isFile: "bool",
isDirectory: "bool",
isSymlink: "bool",
@ -392,8 +392,8 @@
atime,
mtime,
) {
const [atimeSec, atimeNsec] = toUnixTimeFromEpoch(atime);
const [mtimeSec, mtimeNsec] = toUnixTimeFromEpoch(mtime);
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
ops.op_futime_sync(rid, atimeSec, atimeNsec, mtimeSec, mtimeNsec);
}
@ -402,8 +402,8 @@
atime,
mtime,
) {
const [atimeSec, atimeNsec] = toUnixTimeFromEpoch(atime);
const [mtimeSec, mtimeNsec] = toUnixTimeFromEpoch(mtime);
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
await core.opAsync(
"op_futime_async",
rid,
@ -419,8 +419,8 @@
atime,
mtime,
) {
const [atimeSec, atimeNsec] = toUnixTimeFromEpoch(atime);
const [mtimeSec, mtimeNsec] = toUnixTimeFromEpoch(mtime);
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
ops.op_utime_sync(
pathFromURL(path),
atimeSec,
@ -435,8 +435,8 @@
atime,
mtime,
) {
const [atimeSec, atimeNsec] = toUnixTimeFromEpoch(atime);
const [mtimeSec, mtimeNsec] = toUnixTimeFromEpoch(mtime);
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
await core.opAsync(
"op_utime_async",
pathFromURL(path),

View file

@ -172,7 +172,7 @@
);
}
const [status, stdout, stderr] = await SafePromiseAll([
const { 0: status, 1: stdout, 2: stderr } = await SafePromiseAll([
this.#status,
collectOutput(this.#stdout),
collectOutput(this.#stderr),

@ -1 +1 @@
Subproject commit 3e5b0cea163cc0f2b3b0c7cedffc112cc49d6a78
Subproject commit 17e31cec93aef7d014dcc46bc58ef1a86c0a9995

View file

@ -285,7 +285,7 @@ function assertAllExpectationsHaveTests(
const missingTests: string[] = [];
function walk(parentExpectation: Expectation, parent: string) {
for (const key in parentExpectation) {
for (const [key, expectation] of Object.entries(parentExpectation)) {
const path = `${parent}/${key}`;
if (
filter &&
@ -293,7 +293,6 @@ function assertAllExpectationsHaveTests(
) {
continue;
}
const expectation = parentExpectation[key];
if (typeof expectation == "boolean" || Array.isArray(expectation)) {
if (!tests.has(path)) {
missingTests.push(path);
@ -368,8 +367,8 @@ async function update() {
const currentExpectation = getExpectation();
for (const path in resultTests) {
const { passed, failed, testSucceeded } = resultTests[path];
for (const result of Object.values(resultTests)) {
const { passed, failed, testSucceeded } = result;
let finalExpectation: boolean | string[];
if (failed.length == 0 && testSucceeded) {
finalExpectation = true;
@ -655,9 +654,7 @@ function discoverTestsToRun(
parentExpectation: Expectation | string[] | boolean,
prefix: string,
) {
for (const key in parentFolder) {
const entry = parentFolder[key];
for (const [key, entry] of Object.entries(parentFolder)) {
if (Array.isArray(entry)) {
for (
const [path, options] of entry.slice(