mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00: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
1 changed files with 6 additions and 4 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue