mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 04:51:22 +00:00
fix(core): Add lint check for core (#17223)
The prefer-primordials lint was skipped for `core/*.js`.
This commit is contained in:
parent
87c2493855
commit
7b6339da6a
@ -29,6 +29,8 @@
|
||||
// benchmark all changes made in performance-sensitive areas of the codebase.
|
||||
// See: https://github.com/nodejs/node/pull/38248
|
||||
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
"use strict";
|
||||
|
||||
(() => {
|
||||
|
@ -9,22 +9,27 @@
|
||||
SyntaxError,
|
||||
TypeError,
|
||||
URIError,
|
||||
Map,
|
||||
Array,
|
||||
ArrayFrom,
|
||||
ArrayPrototypeFill,
|
||||
ArrayPrototypeJoin,
|
||||
ArrayPrototypePush,
|
||||
ArrayPrototypeMap,
|
||||
ErrorCaptureStackTrace,
|
||||
Function,
|
||||
Promise,
|
||||
ObjectAssign,
|
||||
ObjectFromEntries,
|
||||
ObjectPrototypeHasOwnProperty,
|
||||
Map,
|
||||
MapPrototypeGet,
|
||||
MapPrototypeHas,
|
||||
MapPrototypeDelete,
|
||||
MapPrototypeSet,
|
||||
PromisePrototypeThen,
|
||||
PromisePrototypeFinally,
|
||||
ReflectApply,
|
||||
SafePromisePrototypeFinally,
|
||||
StringPrototypeSlice,
|
||||
ObjectAssign,
|
||||
SymbolFor,
|
||||
setQueueMicrotask,
|
||||
} = window.__bootstrap.primordials;
|
||||
@ -212,11 +217,17 @@
|
||||
}
|
||||
|
||||
// { <name>: <argc>, ... }
|
||||
for (const ele of Object.entries(ops.asyncOpsInfo())) {
|
||||
if (!ele) continue;
|
||||
const [name, argc] = ele;
|
||||
const info = ops.asyncOpsInfo();
|
||||
for (const name in info) {
|
||||
if (!ObjectPrototypeHasOwnProperty(info, name)) {
|
||||
continue;
|
||||
}
|
||||
const argc = info[name];
|
||||
const op = ops[name];
|
||||
const args = Array.from({ length: argc }, (_, i) => `arg${i}`).join(", ");
|
||||
const args = ArrayPrototypeJoin(
|
||||
ArrayFrom({ length: argc }, (_, i) => `arg${i}`),
|
||||
", ",
|
||||
);
|
||||
ops[name] = genAsyncOp(op, name, args);
|
||||
}
|
||||
}
|
||||
@ -225,7 +236,7 @@
|
||||
if (opCallTracingEnabled) {
|
||||
const stack = StringPrototypeSlice(new Error().stack, 6);
|
||||
MapPrototypeSet(opCallTraces, promiseId, { opName, stack });
|
||||
return PromisePrototypeFinally(
|
||||
return SafePromisePrototypeFinally(
|
||||
p,
|
||||
() => MapPrototypeDelete(opCallTraces, promiseId),
|
||||
);
|
||||
@ -235,7 +246,7 @@
|
||||
}
|
||||
|
||||
function opAsync(opName, ...args) {
|
||||
return ops[opName](...args);
|
||||
return ReflectApply(ops[opName], ops, args);
|
||||
}
|
||||
|
||||
function refOp(promiseId) {
|
||||
@ -257,7 +268,7 @@
|
||||
}
|
||||
|
||||
function metrics() {
|
||||
const [aggregate, perOps] = ops.op_metrics();
|
||||
const { 0: aggregate, 1: perOps } = ops.op_metrics();
|
||||
aggregate.ops = ObjectFromEntries(ArrayPrototypeMap(
|
||||
ops.op_op_names(),
|
||||
(opName, opId) => [opName, perOps[opId]],
|
||||
|
@ -130,7 +130,8 @@
|
||||
__callSiteEvals: { __proto__: null, value: [], configurable: true },
|
||||
});
|
||||
const formattedCallSites = [];
|
||||
for (const cse of callSiteEvals) {
|
||||
for (let i = 0; i < callSiteEvals.length; ++i) {
|
||||
const cse = callSiteEvals[i];
|
||||
ArrayPrototypePush(error.__callSiteEvals, cse);
|
||||
ArrayPrototypePush(formattedCallSites, formatCallSiteEval(cse));
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ async function dlintPreferPrimordials() {
|
||||
const sourceFiles = await getSources(ROOT_PATH, [
|
||||
"runtime/**/*.js",
|
||||
"ext/**/*.js",
|
||||
"core/**/*.js",
|
||||
"core/*.js",
|
||||
":!:core/*_test.js",
|
||||
":!:core/examples/**",
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user