mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Meta: Use the ImplementedAs value in the attribute setter
Co-Authored-By: Luke Wilde <lukew@serenityos.org>
This commit is contained in:
parent
b3df222e52
commit
436262ea3a
Notes:
sideshowbarker
2024-07-17 17:20:40 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/436262ea3a Pull-request: https://github.com/SerenityOS/serenity/pull/13052 Reviewed-by: https://github.com/Lubrsi Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/trflynn89
1 changed files with 4 additions and 5 deletions
|
@ -3018,13 +3018,12 @@ static JS::ThrowCompletionOr<@fully_qualified_name@*> impl_from(JS::VM& vm, JS::
|
|||
auto attribute_generator = generator.fork();
|
||||
attribute_generator.set("attribute.getter_callback", attribute.getter_callback_name);
|
||||
attribute_generator.set("attribute.setter_callback", attribute.setter_callback_name);
|
||||
attribute_generator.set("attribute.name:snakecase", attribute.name.to_snakecase());
|
||||
|
||||
if (attribute.extended_attributes.contains("ImplementedAs")) {
|
||||
auto implemented_as = attribute.extended_attributes.get("ImplementedAs").value();
|
||||
attribute_generator.set("attribute.cpp_getter_name", implemented_as);
|
||||
attribute_generator.set("attribute.cpp_name", implemented_as);
|
||||
} else {
|
||||
attribute_generator.set("attribute.cpp_getter_name", attribute.name.to_snakecase());
|
||||
attribute_generator.set("attribute.cpp_name", attribute.name.to_snakecase());
|
||||
}
|
||||
|
||||
if (attribute.extended_attributes.contains("Reflect")) {
|
||||
|
@ -3056,7 +3055,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.getter_callback@)
|
|||
}
|
||||
} else {
|
||||
attribute_generator.append(R"~~~(
|
||||
auto retval = TRY(throw_dom_exception_if_needed(global_object, [&] { return impl->@attribute.cpp_getter_name@(); }));
|
||||
auto retval = TRY(throw_dom_exception_if_needed(global_object, [&] { return impl->@attribute.cpp_name@(); }));
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
@ -3092,7 +3091,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@)
|
|||
}
|
||||
} else {
|
||||
attribute_generator.append(R"~~~(
|
||||
TRY(throw_dom_exception_if_needed(global_object, [&] { return impl->set_@attribute.name:snakecase@(cpp_value); }));
|
||||
TRY(throw_dom_exception_if_needed(global_object, [&] { return impl->set_@attribute.cpp_name@(cpp_value); }));
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue