mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-25 19:02:07 -05:00
js: Implement pretty-printing of Temporal.Calendar objects
This commit is contained in:
parent
bb86d535a9
commit
c82c652ee4
1 changed files with 11 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
|||
#include <LibJS/Runtime/Set.h>
|
||||
#include <LibJS/Runtime/Shape.h>
|
||||
#include <LibJS/Runtime/StringObject.h>
|
||||
#include <LibJS/Runtime/Temporal/Calendar.h>
|
||||
#include <LibJS/Runtime/Temporal/Instant.h>
|
||||
#include <LibJS/Runtime/Temporal/TimeZone.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
|
@ -427,6 +428,14 @@ static void print_data_view(JS::Object const& object, HashTable<JS::Object*>& se
|
|||
out(" @ {:p}", data_view.viewed_array_buffer());
|
||||
}
|
||||
|
||||
static void print_temporal_calendar(JS::Object const& object, HashTable<JS::Object*>& seen_objects)
|
||||
{
|
||||
auto& calendar = static_cast<JS::Temporal::Calendar const&>(object);
|
||||
print_type("Temporal.Calendar");
|
||||
out(" ");
|
||||
print_value(JS::js_string(object.vm(), calendar.identifier()), seen_objects);
|
||||
}
|
||||
|
||||
static void print_temporal_instant(JS::Object const& object, HashTable<JS::Object*>& seen_objects)
|
||||
{
|
||||
auto& instant = static_cast<JS::Temporal::Instant const&>(object);
|
||||
|
@ -505,6 +514,8 @@ static void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects)
|
|||
return print_primitive_wrapper_object("Number", object, seen_objects);
|
||||
if (is<JS::BooleanObject>(object))
|
||||
return print_primitive_wrapper_object("Boolean", object, seen_objects);
|
||||
if (is<JS::Temporal::Calendar>(object))
|
||||
return print_temporal_calendar(object, seen_objects);
|
||||
if (is<JS::Temporal::Instant>(object))
|
||||
return print_temporal_instant(object, seen_objects);
|
||||
if (is<JS::Temporal::TimeZone>(object))
|
||||
|
|
Loading…
Add table
Reference in a new issue