mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 03:56:16 +00:00
LibJS: Convert to_u32() to ThrowCompletionOr
This commit is contained in:
parent
f6a5ff7b00
commit
cc94bba5c0
Notes:
sideshowbarker
2024-07-18 02:12:39 +09:00
Author: https://github.com/IdanHo
Commit: cc94bba5c0
Pull-request: https://github.com/SerenityOS/serenity/pull/10522
Reviewed-by: https://github.com/linusg ✅
14 changed files with 32 additions and 69 deletions
|
@ -1117,13 +1117,11 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||
}
|
||||
} else if (parameter.type->name == "unsigned long") {
|
||||
scoped_generator.append(R"~~~(
|
||||
auto @cpp_name@ = @js_name@@js_suffix@.to_u32(global_object);
|
||||
if (vm.exception())
|
||||
@return_statement@
|
||||
auto @cpp_name@ = TRY_OR_DISCARD(@js_name@@js_suffix@.to_u32(global_object));
|
||||
)~~~");
|
||||
} else if (parameter.type->name == "unsigned short") {
|
||||
scoped_generator.append(R"~~~(
|
||||
auto @cpp_name@ = (u16)@js_name@@js_suffix@.to_u32(global_object);
|
||||
auto @cpp_name@ = @js_name@@js_suffix@.to_u16(global_object);
|
||||
if (vm.exception())
|
||||
@return_statement@
|
||||
)~~~");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue