summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Object.h
diff options
context:
space:
mode:
authorLenny Maiorani <lenny@serenityos.org>2022-03-16 18:26:49 -0600
committerLinus Groh <mail@linusgroh.de>2022-03-19 00:20:46 +0000
commita0367aa43b89b9714a86475407aef5702ae9e79d (patch)
tree5314c918b0698750b0ac1bab1948b370bbfdc363 /Userland/Libraries/LibJS/Runtime/Object.h
parent5b7a5b3c01007b1ba332310ed1b669bd8b4edebc (diff)
downloadserenity-a0367aa43b89b9714a86475407aef5702ae9e79d.zip
DevTools+LibJS+LibWeb: Change class_name to use StringView
This helps make the overall codebase consistent. `class_name()` in `Kernel` is always `StringView`, but not elsewhere. Additionally, this results in the `strlen` (which needs to be done when printing or other operations) always being computed at compile-time.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Object.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Object.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h
index 430acc243c..01012537c5 100644
--- a/Userland/Libraries/LibJS/Runtime/Object.h
+++ b/Userland/Libraries/LibJS/Runtime/Object.h
@@ -10,6 +10,7 @@
#include <AK/Badge.h>
#include <AK/HashMap.h>
#include <AK/String.h>
+#include <AK/StringView.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/MarkedVector.h>
@@ -27,7 +28,7 @@ namespace JS {
#define JS_OBJECT(class_, base_class) \
public: \
using Base = base_class; \
- virtual const char* class_name() const override { return #class_; }
+ virtual StringView class_name() const override { return #class_; }
struct PrivateElement {
enum class Kind {
@@ -166,7 +167,7 @@ public:
bool has_parameter_map() const { return m_has_parameter_map; }
void set_has_parameter_map() { m_has_parameter_map = true; }
- virtual const char* class_name() const override { return "Object"; }
+ virtual StringView class_name() const override { return "Object"sv; }
virtual void visit_edges(Cell::Visitor&) override;
Value get_direct(size_t index) const { return m_storage[index]; }