mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
BindingsGenerator: Use JS::Value::to_string() when new String
Make sure to use JS::Value::to_string() when the IDL interface is marked with the extended attribute UseNewAKString.
This commit is contained in:
parent
99f094905e
commit
2facb0e8ed
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/2facb0e8ed Pull-request: https://github.com/SerenityOS/serenity/pull/17614 Reviewed-by: https://github.com/linusg ✅
@ -1226,9 +1226,15 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||
if (includes_string) {
|
||||
// 14. If types includes a string type, then return the result of converting V to that type.
|
||||
// NOTE: Currently all string types are converted to String.
|
||||
union_generator.append(R"~~~(
|
||||
if (interface.extended_attributes.contains("UseNewAKString")) {
|
||||
union_generator.append(R"~~~(
|
||||
return TRY(@js_name@@js_suffix@.to_string(vm));
|
||||
)~~~");
|
||||
} else {
|
||||
union_generator.append(R"~~~(
|
||||
return TRY(@js_name@@js_suffix@.to_deprecated_string(vm));
|
||||
)~~~");
|
||||
}
|
||||
} else if (numeric_type && includes_bigint) {
|
||||
// 15. If types includes a numeric type and bigint, then return the result of converting V to either that numeric type or bigint.
|
||||
// https://webidl.spec.whatwg.org/#converted-to-a-numeric-type-or-bigint
|
||||
|
Loading…
Reference in New Issue
Block a user