diff options
author | Linus Groh <mail@linusgroh.de> | 2021-02-17 22:21:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-17 23:45:07 +0100 |
commit | ff324fe9890e45216a268c8a373faff51590f1ef (patch) | |
tree | 5a4075f028e03e65cbf2d77ca1dbbd17177e3d72 /Userland/Libraries/LibWeb | |
parent | b07799060fc4245fba1e730eb63f8558c6ba61ad (diff) | |
download | serenity-ff324fe9890e45216a268c8a373faff51590f1ef.zip |
LibWeb: Fix .length of functions generated from IDL
Function::length() is computing the right function length based on its
parameters, but we never called it - instead the *function name length*
was being used, which is obviously wrong. How silly! :^)
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 06213342ad..9f15ee4ad4 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -125,8 +125,6 @@ struct Function { size_t length() const { - // FIXME: This seems to produce a length that is way over what it's supposed to be. - // For example, getElementsByTagName has its length set to 20 when it should be 1. size_t length = 0; for (auto& parameter : parameters) { if (!parameter.optional) @@ -990,10 +988,10 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object) auto function_generator = generator.fork(); function_generator.set("function.name", function.name); function_generator.set("function.name:snakecase", snake_name(function.name)); - function_generator.set("function.name:length", String::number(function.name.length())); + function_generator.set("function.length", String::number(function.length())); function_generator.append(R"~~~( - define_native_function("@function.name@", @function.name:snakecase@, @function.name:length@, default_attributes); + define_native_function("@function.name@", @function.name:snakecase@, @function.length@, default_attributes); )~~~"); } |