Skip to content

Commit

Permalink
chore: Turn back on dlintPreferPrimordials (#17715)
Browse files Browse the repository at this point in the history
Closes #17709
  • Loading branch information
petamoriken committed Apr 2, 2023
1 parent ad8d0c9 commit 03edd48
Show file tree
Hide file tree
Showing 21 changed files with 688 additions and 308 deletions.
3 changes: 3 additions & 0 deletions core/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 588,7 @@ declare namespace __bootstrap {
export const MapLength: typeof Map.length;
export const MapName: typeof Map.name;
export const MapPrototype: typeof Map.prototype;
export const MapPrototypeGetSize: (map: Map) => number;
export const MapPrototypeGet: UncurryThis<typeof Map.prototype.get>;
export const MapPrototypeSet: UncurryThis<typeof Map.prototype.set>;
export const MapPrototypeHas: UncurryThis<typeof Map.prototype.has>;
Expand Down Expand Up @@ -715,6 716,7 @@ declare namespace __bootstrap {
export const SetLength: typeof Set.length;
export const SetName: typeof Set.name;
export const SetPrototype: typeof Set.prototype;
export const SetPrototypeGetSize: (set: Set) => number;
export const SetPrototypeHas: UncurryThis<typeof Set.prototype.has>;
export const SetPrototypeAdd: UncurryThis<typeof Set.prototype.add>;
export const SetPrototypeDelete: UncurryThis<typeof Set.prototype.delete>;
Expand Down Expand Up @@ -866,6 868,7 @@ declare namespace __bootstrap {
export const SymbolLength: typeof Symbol.length;
export const SymbolName: typeof Symbol.name;
export const SymbolPrototype: typeof Symbol.prototype;
export const SymbolPrototypeGetDescription: (symbol: symbol) => string;
export const SymbolFor: typeof Symbol.for;
export const SymbolKeyFor: typeof Symbol.keyFor;
export const SymbolAsyncIterator: typeof Symbol.asyncIterator;
Expand Down
20 changes: 9 additions & 11 deletions ext/console/02_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 64,7 @@ const {
SymbolPrototype,
SymbolPrototypeToString,
SymbolPrototypeValueOf,
SymbolPrototypeGetDescription,
SymbolToStringTag,
SymbolHasInstance,
SymbolFor,
Expand Down Expand Up @@ -662,7 663,7 @@ function handleCircular(value, cyan) {
} else {
index = MapPrototypeGet(circular, value);
if (index === undefined) {
index = circular.size 1;
index = MapPrototypeGetSize(circular) 1;
MapPrototypeSet(circular, value, index);
}
}
Expand Down Expand Up @@ -809,20 810,17 @@ const QUOTE_SYMBOL_REG = new SafeRegExp(/^[a-zA-Z_][a-zA-Z_.0-9]*$/);

// Surround a symbol's description in quotes when it is required (e.g the description has non printable characters).
function maybeQuoteSymbol(symbol, inspectOptions) {
if (symbol.description === undefined) {
const description = SymbolPrototypeGetDescription(symbol);

if (description === undefined) {
return SymbolPrototypeToString(symbol);
}

if (
RegExpPrototypeTest(
QUOTE_SYMBOL_REG,
symbol.description,
)
) {
if (RegExpPrototypeTest(QUOTE_SYMBOL_REG, description)) {
return SymbolPrototypeToString(symbol);
}

return `Symbol(${quoteString(symbol.description, inspectOptions)})`;
return `Symbol(${quoteString(description, inspectOptions)})`;
}

const CTX_STACK = [];
Expand Down Expand Up @@ -1191,8 1189,8 @@ function inspectRawObject(
symbolKeys,
(s1, s2) =>
StringPrototypeLocaleCompare(
s1.description ?? "",
s2.description ?? "",
SymbolPrototypeGetDescription(s1) ?? "",
SymbolPrototypeGetDescription(s2) ?? "",
),
);
}
Expand Down
Loading

0 comments on commit 03edd48

Please sign in to comment.