Unbreak repl string output (#300)

- fix incorrect argument in s = `JSON.stringify(s);`
- add closures for `RegExp` and `JSON`
This commit is contained in:
Charlie Gordon 2024-03-10 13:32:33 +01:00 committed by GitHub
parent 33e38bec00
commit 8d0d9391f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6675 additions and 6662 deletions

13333
gen/repl.c

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,9 @@ import * as os from "os";
var String = g.String; var String = g.String;
var Array = g.Array; var Array = g.Array;
var Date = g.Date; var Date = g.Date;
var RegExp = g.RegExp;
var Math = g.Math; var Math = g.Math;
var JSON = g.JSON;
var isFinite = g.isFinite; var isFinite = g.isFinite;
var parseFloat = g.parseFloat; var parseFloat = g.parseFloat;
@ -977,7 +979,7 @@ import * as os from "os";
stack.pop(a); stack.pop(a);
} }
} else if (type === "string") { } else if (type === "string") {
s = JSON.stringify(s); s = JSON.stringify(a);
if (s.length > 79) if (s.length > 79)
s = s.substring(0, 75) + "...\""; s = s.substring(0, 75) + "...\"";
std.puts(s); std.puts(s);