This commit is contained in:
Marvin Hagemeister 2024-08-16 16:27:39 +02:00
parent 71ab7d44c5
commit cff57aeb10
4 changed files with 11 additions and 20 deletions

View File

@ -364,9 +364,6 @@ const nodeCustomInspectSymbol = SymbolFor("nodejs.util.inspect.custom");
// Internal only, shouldn't be used by users.
const privateCustomInspect = SymbolFor("Deno.privateCustomInspect");
// Used to keep track if it's a wrapped inspect proxy
const privateCustomInspectProxy = SymbolFor("Deno.privateCustomInspectProxy");
function getUserOptions(ctx, isCrossContext) {
const ret = {
stylize: ctx.stylize,
@ -454,7 +451,7 @@ function formatValue(
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it.
if (ctx.customInspect) {
if (ctx.customInspect && proxyDetails === null) {
if (
ReflectHas(value, customInspect) &&
typeof value[customInspect] === "function"
@ -627,7 +624,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) {
let extrasType = kObjectType;
if (proxyDetails !== null && !ReflectGet(value, privateCustomInspectProxy)) {
if (proxyDetails !== null) {
if (ctx.showProxy) {
return `Proxy ` + formatValue(ctx, proxyDetails, recurseTimes);
}

View File

@ -4,9 +4,12 @@
/// <reference lib="esnext" />
declare module "ext:deno_console/01_console.js" {
function createFilteredInspectProxy<TObject>(params: {
object: TObject;
keys: (keyof TObject)[];
evaluate: boolean;
}): Record<string, unknown>;
function privateInspect<TObject>(
object: TObject,
keys: (keyof TObject)[],
// deno-lint-ignore no-explicit-any
inspect: any,
// deno-lint-ignore no-explicit-any
inspectOptions: any,
): string;
}

View File

@ -435,9 +435,7 @@ class Blob {
}
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
// return privateInspect(this, ["size", "type"], inspect, inspectOptions);
const { size, type } = this;
const value = { size, type };
const value = { size: this[_size], type: this[_type] };
return `${this.constructor.name} ${inspect(value, inspectOptions)}`;
}
}

View File

@ -1138,13 +1138,6 @@ function assertBranded(self, prototype) {
if (
!ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand
) {
console.log(
self.toString(),
prototype.toString(),
self === prototype,
self[brand],
brand.toString(),
);
throw new TypeError("Illegal invocation");
}
}