mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
This commit is contained in:
parent
2ac575abfb
commit
948f85216a
31 changed files with 222 additions and 141 deletions
|
@ -20,6 +20,7 @@
|
|||
PromiseResolve,
|
||||
PromiseReject,
|
||||
ReflectHas,
|
||||
SafeArrayIterator,
|
||||
SymbolFor,
|
||||
TypeError,
|
||||
} = window.__bootstrap.primordials;
|
||||
|
@ -233,7 +234,9 @@
|
|||
function serializePermissions(permissions) {
|
||||
if (typeof permissions == "object" && permissions != null) {
|
||||
const serializedPermissions = {};
|
||||
for (const key of ["read", "write", "run", "ffi"]) {
|
||||
for (
|
||||
const key of new SafeArrayIterator(["read", "write", "run", "ffi"])
|
||||
) {
|
||||
if (ArrayIsArray(permissions[key])) {
|
||||
serializedPermissions[key] = ArrayPrototypeMap(
|
||||
permissions[key],
|
||||
|
@ -243,7 +246,9 @@
|
|||
serializedPermissions[key] = permissions[key];
|
||||
}
|
||||
}
|
||||
for (const key of ["env", "hrtime", "net", "sys"]) {
|
||||
for (
|
||||
const key of new SafeArrayIterator(["env", "hrtime", "net", "sys"])
|
||||
) {
|
||||
if (ArrayIsArray(permissions[key])) {
|
||||
serializedPermissions[key] = ArrayPrototypeSlice(permissions[key]);
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
Uint8Array,
|
||||
ArrayPrototypePush,
|
||||
MathMin,
|
||||
SafeArrayIterator,
|
||||
TypedArrayPrototypeSubarray,
|
||||
TypedArrayPrototypeSet,
|
||||
} = window.__bootstrap.primordials;
|
||||
|
@ -156,14 +157,14 @@
|
|||
|
||||
function concatBuffers(buffers) {
|
||||
let totalLen = 0;
|
||||
for (const buf of buffers) {
|
||||
for (const buf of new SafeArrayIterator(buffers)) {
|
||||
totalLen += buf.byteLength;
|
||||
}
|
||||
|
||||
const contents = new Uint8Array(totalLen);
|
||||
|
||||
let n = 0;
|
||||
for (const buf of buffers) {
|
||||
for (const buf of new SafeArrayIterator(buffers)) {
|
||||
TypedArrayPrototypeSet(contents, buf, n);
|
||||
n += buf.byteLength;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
DatePrototype,
|
||||
MathTrunc,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
SafeArrayIterator,
|
||||
SymbolAsyncIterator,
|
||||
SymbolIterator,
|
||||
Function,
|
||||
|
@ -211,7 +212,7 @@
|
|||
let offset = 0;
|
||||
let str =
|
||||
'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux"; return {';
|
||||
for (let [name, type] of ObjectEntries(types)) {
|
||||
for (let [name, type] of new SafeArrayIterator(ObjectEntries(types))) {
|
||||
const optional = type.startsWith("?");
|
||||
if (optional) type = type.slice(1);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
ArrayPrototypeSlice,
|
||||
TypeError,
|
||||
ObjectEntries,
|
||||
SafeArrayIterator,
|
||||
String,
|
||||
} = window.__bootstrap.primordials;
|
||||
|
||||
|
@ -111,7 +112,10 @@
|
|||
stdin = "inherit",
|
||||
}) {
|
||||
if (cmd[0] != null) {
|
||||
cmd = [pathFromURL(cmd[0]), ...ArrayPrototypeSlice(cmd, 1)];
|
||||
cmd = [
|
||||
pathFromURL(cmd[0]),
|
||||
...new SafeArrayIterator(ArrayPrototypeSlice(cmd, 1)),
|
||||
];
|
||||
}
|
||||
const res = opRun({
|
||||
cmd: ArrayPrototypeMap(cmd, String),
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
const core = window.Deno.core;
|
||||
const ops = core.ops;
|
||||
const {
|
||||
SafeSetIterator,
|
||||
Set,
|
||||
SetPrototypeDelete,
|
||||
SymbolFor,
|
||||
TypeError,
|
||||
} = window.__bootstrap.primordials;
|
||||
|
@ -60,7 +62,7 @@
|
|||
checkSignalListenerType(listener);
|
||||
|
||||
const sigData = getSignalData(signo);
|
||||
sigData.listeners.delete(listener);
|
||||
SetPrototypeDelete(sigData.listeners, listener);
|
||||
|
||||
if (sigData.listeners.size === 0 && sigData.rid) {
|
||||
unbindSignal(sigData.rid);
|
||||
|
@ -73,7 +75,7 @@
|
|||
if (await pollSignal(sigData.rid)) {
|
||||
return;
|
||||
}
|
||||
for (const listener of sigData.listeners) {
|
||||
for (const listener of new SafeSetIterator(sigData.listeners)) {
|
||||
listener();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
const {
|
||||
ArrayPrototypeMap,
|
||||
ObjectEntries,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
String,
|
||||
TypeError,
|
||||
PromisePrototypeThen,
|
||||
|
@ -21,6 +22,7 @@
|
|||
readableStreamForRidUnrefable,
|
||||
readableStreamForRidUnrefableRef,
|
||||
readableStreamForRidUnrefableUnref,
|
||||
ReadableStreamPrototype,
|
||||
writableStreamForRid,
|
||||
} = window.__bootstrap.streams;
|
||||
|
||||
|
@ -65,7 +67,9 @@
|
|||
}
|
||||
|
||||
function collectOutput(readableStream) {
|
||||
if (!(readableStream instanceof ReadableStream)) {
|
||||
if (
|
||||
!(ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, readableStream))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ delete Intl.v8BreakIterator;
|
|||
ArrayPrototypeMap,
|
||||
DateNow,
|
||||
Error,
|
||||
ErrorPrototype,
|
||||
FunctionPrototypeCall,
|
||||
FunctionPrototypeBind,
|
||||
ObjectAssign,
|
||||
|
@ -32,6 +33,7 @@ delete Intl.v8BreakIterator;
|
|||
SymbolFor,
|
||||
SymbolIterator,
|
||||
PromisePrototypeThen,
|
||||
SafeArrayIterator,
|
||||
SafeWeakMap,
|
||||
TypeError,
|
||||
WeakMapPrototypeDelete,
|
||||
|
@ -204,7 +206,7 @@ delete Intl.v8BreakIterator;
|
|||
);
|
||||
loadedMainWorkerScript = true;
|
||||
|
||||
for (const { url, script } of scripts) {
|
||||
for (const { url, script } of new SafeArrayIterator(scripts)) {
|
||||
const err = core.evalContext(script, url)[1];
|
||||
if (err !== null) {
|
||||
throw err.thrown;
|
||||
|
@ -217,7 +219,7 @@ delete Intl.v8BreakIterator;
|
|||
}
|
||||
|
||||
function formatException(error) {
|
||||
if (error instanceof Error) {
|
||||
if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, error)) {
|
||||
return null;
|
||||
} else if (typeof error == "string") {
|
||||
return `Uncaught ${
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue