summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-22 20:44:30 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-22 21:21:46 +0200
commit49f3d88baf6fff825c2bf4f3253b3d4916c5274b (patch)
treecd9688bc98306b4afb80a6fb4ac76c3a147ed270
parentdc0fc16981b61dadd6be1aed9a024de24194d1cd (diff)
downloadserenity-49f3d88baf6fff825c2bf4f3253b3d4916c5274b.zip
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. :^)
-rw-r--r--Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp5
1 files changed, 5 insertions, 0 deletions
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
@@ -770,6 +770,11 @@ public:
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")) {
generator.append(R"~~~(
virtual bool put(const JS::PropertyName&, JS::Value, JS::Value receiver = {}) override;