mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 20:38:55 +00:00
WIP
This commit is contained in:
parent
71ab7d44c5
commit
cff57aeb10
@ -364,9 +364,6 @@ const nodeCustomInspectSymbol = SymbolFor("nodejs.util.inspect.custom");
|
|||||||
// Internal only, shouldn't be used by users.
|
// Internal only, shouldn't be used by users.
|
||||||
const privateCustomInspect = SymbolFor("Deno.privateCustomInspect");
|
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) {
|
function getUserOptions(ctx, isCrossContext) {
|
||||||
const ret = {
|
const ret = {
|
||||||
stylize: ctx.stylize,
|
stylize: ctx.stylize,
|
||||||
@ -454,7 +451,7 @@ function formatValue(
|
|||||||
|
|
||||||
// Provide a hook for user-specified inspect functions.
|
// Provide a hook for user-specified inspect functions.
|
||||||
// Check that value is an object with an inspect function on it.
|
// Check that value is an object with an inspect function on it.
|
||||||
if (ctx.customInspect) {
|
if (ctx.customInspect && proxyDetails === null) {
|
||||||
if (
|
if (
|
||||||
ReflectHas(value, customInspect) &&
|
ReflectHas(value, customInspect) &&
|
||||||
typeof value[customInspect] === "function"
|
typeof value[customInspect] === "function"
|
||||||
@ -627,7 +624,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) {
|
|||||||
|
|
||||||
let extrasType = kObjectType;
|
let extrasType = kObjectType;
|
||||||
|
|
||||||
if (proxyDetails !== null && !ReflectGet(value, privateCustomInspectProxy)) {
|
if (proxyDetails !== null) {
|
||||||
if (ctx.showProxy) {
|
if (ctx.showProxy) {
|
||||||
return `Proxy ` + formatValue(ctx, proxyDetails, recurseTimes);
|
return `Proxy ` + formatValue(ctx, proxyDetails, recurseTimes);
|
||||||
}
|
}
|
||||||
|
13
ext/console/internal.d.ts
vendored
13
ext/console/internal.d.ts
vendored
@ -4,9 +4,12 @@
|
|||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
declare module "ext:deno_console/01_console.js" {
|
declare module "ext:deno_console/01_console.js" {
|
||||||
function createFilteredInspectProxy<TObject>(params: {
|
function privateInspect<TObject>(
|
||||||
object: TObject;
|
object: TObject,
|
||||||
keys: (keyof TObject)[];
|
keys: (keyof TObject)[],
|
||||||
evaluate: boolean;
|
// deno-lint-ignore no-explicit-any
|
||||||
}): Record<string, unknown>;
|
inspect: any,
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
|
inspectOptions: any,
|
||||||
|
): string;
|
||||||
}
|
}
|
||||||
|
@ -435,9 +435,7 @@ class Blob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||||
// return privateInspect(this, ["size", "type"], inspect, inspectOptions);
|
const value = { size: this[_size], type: this[_type] };
|
||||||
const { size, type } = this;
|
|
||||||
const value = { size, type };
|
|
||||||
return `${this.constructor.name} ${inspect(value, inspectOptions)}`;
|
return `${this.constructor.name} ${inspect(value, inspectOptions)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1138,13 +1138,6 @@ function assertBranded(self, prototype) {
|
|||||||
if (
|
if (
|
||||||
!ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand
|
!ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand
|
||||||
) {
|
) {
|
||||||
console.log(
|
|
||||||
self.toString(),
|
|
||||||
prototype.toString(),
|
|
||||||
self === prototype,
|
|
||||||
self[brand],
|
|
||||||
brand.toString(),
|
|
||||||
);
|
|
||||||
throw new TypeError("Illegal invocation");
|
throw new TypeError("Illegal invocation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user