mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Generate Optional<NonnullGCPtr<T>> as GCPtr<T>
This is the general pattern which has been adopted in LibWeb, so let's generate our IDL like this too.
This commit is contained in:
parent
3a0e69d86f
commit
80658743d3
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/shannonbooth
Commit: 80658743d3
Pull-request: https://github.com/SerenityOS/serenity/pull/23877
Reviewed-by: https://github.com/kennethmyhra ✅
7 changed files with 11 additions and 11 deletions
|
@ -513,7 +513,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||
)~~~");
|
||||
} else {
|
||||
scoped_generator.append(R"~~~(
|
||||
Optional<JS::NonnullGCPtr<@parameter.type.name@>> @cpp_name@;
|
||||
JS::GCPtr<@parameter.type.name@> @cpp_name@;
|
||||
if (!@js_name@@js_suffix@.is_undefined()) {
|
||||
if (!@js_name@@js_suffix@.is_object() || !is<@parameter.type.name@>(@js_name@@js_suffix@.as_object()))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "@parameter.type.name@");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue