From 49f3d88baf6fff825c2bf4f3253b3d4916c5274b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Apr 2021 20:44:30 +0200 Subject: [PATCH] LibWeb: Allow IDL interfaces to override get_by_index() You can now specify the "CustomGetByIndex" extended interface attribute which will cause the generator to emit an override declaration for JS::Object::get_by_index(). It's up to you to implement that function somewhere. Just like the CustomGet mechanism already works. :^) --- .../Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 3c4ab96c0e..f96a054e98 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -768,6 +768,11 @@ public: if (interface.extended_attributes.contains("CustomGet")) { generator.append(R"~~~( virtual JS::Value get(const JS::PropertyName&, JS::Value receiver = {}, bool without_side_effects = false) const override; +)~~~"); + } + if (interface.extended_attributes.contains("CustomGetByIndex")) { + generator.append(R"~~~( + virtual JS::Value get_by_index(u32 property_index) const override; )~~~"); } if (interface.extended_attributes.contains("CustomPut")) {