mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
wasm: Don't try to print the function results if it traps
This commit is contained in:
parent
23b48f8fe1
commit
bacf5a7220
Notes:
sideshowbarker
2024-07-18 08:54:48 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/bacf5a7220c
1 changed files with 10 additions and 8 deletions
|
@ -512,14 +512,16 @@ int main(int argc, char* argv[])
|
|||
if (debug)
|
||||
launch_repl();
|
||||
|
||||
if (result.is_trap())
|
||||
warnln("Execution trapped!");
|
||||
if (!result.values().is_empty())
|
||||
warnln("Returned:");
|
||||
for (auto& value : result.values()) {
|
||||
Wasm::Printer printer { stream };
|
||||
g_stdout.write(" -> "sv.bytes());
|
||||
g_printer.print(value);
|
||||
if (result.is_trap()) {
|
||||
warnln("Execution trapped: {}", result.trap().reason);
|
||||
} else {
|
||||
if (!result.values().is_empty())
|
||||
warnln("Returned:");
|
||||
for (auto& value : result.values()) {
|
||||
Wasm::Printer printer { stream };
|
||||
g_stdout.write(" -> "sv.bytes());
|
||||
g_printer.print(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue