summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/BigIntObject.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-21 15:14:02 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-21 15:15:52 +0200
commitaf51dc105a1ab91a01cb8e343980e96167350f5b (patch)
treea1b524d14b566e9cb294be29a08314ccef9c2f51 /Libraries/LibJS/Runtime/BigIntObject.h
parent1914f52371bbd846bf3d154493e3fb993a202a6e (diff)
downloadserenity-af51dc105a1ab91a01cb8e343980e96167350f5b.zip
LibJS+LibWeb: Add JS::Object::inherits(class_name)
To allow implementing the DOM class hierarchy in JS bindings, this patch adds an inherits() function that can be used to ask an Object if it inherits from a specific C++ class (by name). The necessary overrides are baked into each Object subclass by the new JS_OBJECT macro, which works similarly to C_OBJECT in LibCore. Thanks to @Dexesttp for suggesting this approach. :^)
Diffstat (limited to 'Libraries/LibJS/Runtime/BigIntObject.h')
-rw-r--r--Libraries/LibJS/Runtime/BigIntObject.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/BigIntObject.h b/Libraries/LibJS/Runtime/BigIntObject.h
index 5c5a273400..05a3e9db6b 100644
--- a/Libraries/LibJS/Runtime/BigIntObject.h
+++ b/Libraries/LibJS/Runtime/BigIntObject.h
@@ -32,6 +32,8 @@
namespace JS {
class BigIntObject final : public Object {
+ JS_OBJECT(BigIntObject, Object);
+
public:
static BigIntObject* create(GlobalObject&, BigInt&);
@@ -46,7 +48,6 @@ public:
private:
virtual void visit_children(Visitor&) override;
- virtual const char* class_name() const override { return "BigIntObject"; }
virtual bool is_bigint_object() const override { return true; }
BigInt& m_bigint;