mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-01 15:43:36 +03:00
LibWeb/IDL: Respect type of IDL constants
Previously we ignored the type and cast the value to i32 and then put it into a JS::Value.
This commit is contained in:
parent
98f354cec4
commit
29b0277a71
Notes:
sideshowbarker
2024-07-17 10:16:48 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/29b0277a71 Pull-request: https://github.com/SerenityOS/serenity/pull/14184 Reviewed-by: https://github.com/Quaker762 ✅ Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/sunverwerth
@ -2824,10 +2824,11 @@ void @constructor_class@::initialize(JS::GlobalObject& global_object)
|
||||
for (auto& constant : interface.constants) {
|
||||
auto constant_generator = generator.fork();
|
||||
constant_generator.set("constant.name", constant.name);
|
||||
constant_generator.set("constant.value", constant.value);
|
||||
|
||||
generate_wrap_statement(constant_generator, constant.value, constant.type, interface, String::formatted("auto constant_{}_value =", constant.name));
|
||||
|
||||
constant_generator.append(R"~~~(
|
||||
define_direct_property("@constant.name@", JS::Value((i32)@constant.value@), JS::Attribute::Enumerable);
|
||||
define_direct_property("@constant.name@", constant_@constant.name@_value, JS::Attribute::Enumerable);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
@ -3092,10 +3093,11 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
||||
|
||||
auto constant_generator = generator.fork();
|
||||
constant_generator.set("constant.name", constant.name);
|
||||
constant_generator.set("constant.value", constant.value);
|
||||
|
||||
generate_wrap_statement(constant_generator, constant.value, constant.type, interface, String::formatted("auto constant_{}_value =", constant.name));
|
||||
|
||||
constant_generator.append(R"~~~(
|
||||
define_direct_property("@constant.name@", JS::Value((i32)@constant.value@), JS::Attribute::Enumerable);
|
||||
define_direct_property("@constant.name@", constant_@constant.name@_value, JS::Attribute::Enumerable);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user