mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:15:09 +00:00
js: Fix pretty-printing of RegExp objects
Regressed in b7e5f08
.
Use the newly available RegExpObject::escape_regexp_pattern() instead of
attempting to call the RegExp.prototype.source accessor getter directly.
This commit is contained in:
parent
78fd8c1ca2
commit
fe802f5ff5
1 changed files with 1 additions and 3 deletions
|
@ -287,10 +287,8 @@ static void print_error(JS::Object const& object, HashTable<JS::Object*>& seen_o
|
|||
static void print_regexp_object(JS::Object const& object, HashTable<JS::Object*>&)
|
||||
{
|
||||
auto& regexp_object = static_cast<JS::RegExpObject const&>(object);
|
||||
// Use RegExp.prototype.source rather than RegExpObject::pattern() so we get proper escaping
|
||||
auto source = regexp_object.get_without_side_effects("source").to_primitive_string(object.global_object())->string();
|
||||
print_type("RegExp");
|
||||
out(" \033[34;1m/{}/{}\033[0m", source, regexp_object.flags());
|
||||
out(" \033[34;1m/{}/{}\033[0m", regexp_object.escape_regexp_pattern(), regexp_object.flags());
|
||||
}
|
||||
|
||||
static void print_proxy_object(JS::Object const& object, HashTable<JS::Object*>& seen_objects)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue