mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +00:00
Meta/IDL: Correctly generate variable names when value contains a dot
This commit is contained in:
parent
4070f5a7e0
commit
69c6b6df91
Notes:
github-actions[bot]
2025-08-27 08:00:10 +00:00
Author: https://github.com/stelar7
Commit: 69c6b6df91
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5665
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/trflynn89
1 changed files with 4 additions and 3 deletions
|
@ -1845,6 +1845,7 @@ static void generate_wrap_statement(SourceGenerator& generator, ByteString const
|
|||
{
|
||||
auto scoped_generator = generator.fork();
|
||||
scoped_generator.set("value", value);
|
||||
scoped_generator.set("value_cpp_name", value.replace("."sv, "_"sv));
|
||||
if (!libweb_interface_namespaces.span().contains_slow(type.name())) {
|
||||
if (is_javascript_builtin(type))
|
||||
scoped_generator.set("type", ByteString::formatted("JS::{}", type.name()));
|
||||
|
@ -1916,9 +1917,9 @@ static void generate_wrap_statement(SourceGenerator& generator, ByteString const
|
|||
|
||||
if (type.is_nullable() || is_optional) {
|
||||
scoped_generator.append(R"~~~(
|
||||
auto& @value@_non_optional = @value@.value();
|
||||
for (size_t i@recursion_depth@ = 0; i@recursion_depth@ < @value@_non_optional.size(); ++i@recursion_depth@) {
|
||||
auto& element@recursion_depth@ = @value@_non_optional.at(i@recursion_depth@);
|
||||
auto& @value_cpp_name@_non_optional = @value@.value();
|
||||
for (size_t i@recursion_depth@ = 0; i@recursion_depth@ < @value_cpp_name@_non_optional.size(); ++i@recursion_depth@) {
|
||||
auto& element@recursion_depth@ = @value_cpp_name@_non_optional.at(i@recursion_depth@);
|
||||
)~~~");
|
||||
} else {
|
||||
scoped_generator.append(R"~~~(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue