diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 047410a543..1ceda2b5ef 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -923,12 +923,25 @@ static void print_intl_duration_format(JS::Intl::DurationFormat const& duration_ } } -static void print_primitive_wrapper_object(FlyString const& name, JS::Object const& object, HashTable& seen_objects) +static void print_boolean_object(JS::BooleanObject const& boolean_object, HashTable& seen_objects) { - // BooleanObject, NumberObject, StringObject - print_type(name); + print_type("Boolean"); js_out(" "); - print_value(&object, seen_objects); + print_value(JS::Value(boolean_object.boolean()), seen_objects); +} + +static void print_number_object(JS::NumberObject const& number_object, HashTable& seen_objects) +{ + print_type("Number"); + js_out(" "); + print_value(JS::Value(number_object.number()), seen_objects); +} + +static void print_string_object(JS::StringObject const& string_object, HashTable& seen_objects) +{ + print_type("String"); + js_out(" "); + print_value(&string_object.primitive_string(), seen_objects); } static void print_value(JS::Value value, HashTable& seen_objects) @@ -985,12 +998,12 @@ static void print_value(JS::Value value, HashTable& seen_objects) return print_async_generator(static_cast(object), seen_objects); if (object.is_typed_array()) return print_typed_array(static_cast(object), seen_objects); - if (is(object)) - return print_primitive_wrapper_object("String", object, seen_objects); - if (is(object)) - return print_primitive_wrapper_object("Number", object, seen_objects); if (is(object)) - return print_primitive_wrapper_object("Boolean", object, seen_objects); + return print_boolean_object(static_cast(object), seen_objects); + if (is(object)) + return print_number_object(static_cast(object), seen_objects); + if (is(object)) + return print_string_object(static_cast(object), seen_objects); if (is(object)) return print_temporal_calendar(static_cast(object), seen_objects); if (is(object))