mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +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
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();
|
auto attribute_generator = generator.fork();
|
||||||
attribute_generator.set("attribute.getter_callback", attribute.getter_callback_name);
|
attribute_generator.set("attribute.getter_callback", attribute.getter_callback_name);
|
||||||
attribute_generator.set("attribute.setter_callback", attribute.setter_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")) {
|
if (attribute.extended_attributes.contains("ImplementedAs")) {
|
||||||
auto implemented_as = attribute.extended_attributes.get("ImplementedAs").value();
|
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 {
|
} 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")) {
|
if (attribute.extended_attributes.contains("Reflect")) {
|
||||||
|
@ -3056,7 +3055,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.getter_callback@)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
attribute_generator.append(R"~~~(
|
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 {
|
} else {
|
||||||
attribute_generator.append(R"~~~(
|
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…
Add table
Add a link
Reference in a new issue