mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:44:58 +00:00
LibJS: Fix redundancy-detection when printing raw values
Note that this does not change cycle-detection. This is also was an unnecessary copy, since there is an easier, less memory-intense way to do cycle detection than copying the entire visited_set all the time.
This commit is contained in:
parent
72756f09f4
commit
a9b3aaa887
2 changed files with 4 additions and 3 deletions
|
@ -32,7 +32,8 @@ ErrorOr<String> MarkupGenerator::html_from_source(StringView source)
|
|||
ErrorOr<String> MarkupGenerator::html_from_value(Value value)
|
||||
{
|
||||
StringBuilder output_html;
|
||||
TRY(value_to_html(value, output_html));
|
||||
HashTable<Object*> seen_objects;
|
||||
TRY(value_to_html(value, output_html, seen_objects));
|
||||
return output_html.to_string();
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ ErrorOr<String> MarkupGenerator::html_from_error(Error const& object, bool in_pr
|
|||
return output_html.to_string();
|
||||
}
|
||||
|
||||
ErrorOr<void> MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, HashTable<Object*> seen_objects)
|
||||
ErrorOr<void> MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, HashTable<Object*>& seen_objects)
|
||||
{
|
||||
if (value.is_empty()) {
|
||||
TRY(output_html.try_append("<empty>"sv));
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
ObjectType,
|
||||
};
|
||||
|
||||
static ErrorOr<void> value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
|
||||
static ErrorOr<void> value_to_html(Value, StringBuilder& output_html, HashTable<Object*>& seen_objects);
|
||||
static ErrorOr<void> array_to_html(Array const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static ErrorOr<void> object_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static ErrorOr<void> function_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue