Check for RegExp objects before going the standard object path in REPL

This commit is contained in:
Saúl Ibarra Corretgé 2024-03-19 11:57:16 +01:00
parent 48cb3ac410
commit dd2427785f
2 changed files with 2554 additions and 2557 deletions

5107
gen/repl.c

File diff suppressed because it is too large Load diff

View file

@ -942,6 +942,8 @@ import * as os from "os";
std.puts("[circular]"); std.puts("[circular]");
} else if (a instanceof Date) { } else if (a instanceof Date) {
std.puts(`Date ${JSON.stringify(a.toGMTString())}`); std.puts(`Date ${JSON.stringify(a.toGMTString())}`);
} else if (a instanceof RegExp) {
std.puts(a.toString());
} else { } else {
stack.push(a); stack.push(a);
if (Array.isArray(a)) { if (Array.isArray(a)) {
@ -961,8 +963,6 @@ import * as os from "os";
} }
} }
std.puts(" ]"); std.puts(" ]");
} else if (a instanceof RegExp) {
std.puts(a.toString());
} else { } else {
keys = Object.keys(a); keys = Object.keys(a);
n = keys.length; n = keys.length;