1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibWeb+LibJS: Add a naive way to check if a wrapper "is" a certain type

Instead of only checking the class_name(), we now generate an is_foo()
virtual in the wrapper generator. (It's currently something we override
on Bindings::Wrapper, which is not really scalable.)

Longer term we'll need to think up something smarter for verifying that
one wrapper "is" another type of wrapper.
This commit is contained in:
Andreas Kling 2020-06-20 22:19:29 +02:00
parent 1ffffa0053
commit 94fdf4fa5a
3 changed files with 19 additions and 4 deletions

View file

@ -111,6 +111,8 @@ public:
virtual bool is_symbol_object() const { return false; }
virtual bool is_bigint_object() const { return false; }
virtual bool is_web_wrapper() const { return false; }
virtual const char* class_name() const override { return "Object"; }
virtual void visit_children(Cell::Visitor&) override;