BindingsGenerator: Pass optional values as 'sv' to String::from_utf8()

Pass optional values as StringView to String::from_utf8(), otherwise
this would not compile.
This commit is contained in:
Kenneth Myhra 2023-02-23 12:18:20 +01:00 committed by Sam Atkins
parent be727ea871
commit 98ef76b144

View file

@ -343,7 +343,7 @@ static void generate_to_new_string(SourceGenerator& scoped_generator, ParameterT
})~~~");
if (optional_default_value.has_value() && (!parameter.type->is_nullable() || optional_default_value.value() != "null")) {
scoped_generator.append(R"~~~( else {
@cpp_name@ = TRY_OR_THROW_OOM(vm, String::from_utf8(@parameter.optional_default_value@));
@cpp_name@ = TRY_OR_THROW_OOM(vm, String::from_utf8(@parameter.optional_default_value@sv));
}
)~~~");
} else {