mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 10:19:03 +03:00
js: Print the accumulator instead of the returned value in BC mode
The REPL is supposed to show the last value (and not the _returned_ value), so use the accumulator register as the 'value'.
This commit is contained in:
parent
f0f97e1db0
commit
431776ebb7
Notes:
sideshowbarker
2024-07-17 14:25:37 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/431776ebb7 Pull-request: https://github.com/SerenityOS/serenity/pull/13517
@ -1051,7 +1051,11 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
||||
|
||||
if (s_run_bytecode) {
|
||||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter.global_object(), interpreter.realm());
|
||||
result = bytecode_interpreter.run(*executable);
|
||||
auto result_or_error = bytecode_interpreter.run_and_return_frame(*executable, nullptr);
|
||||
if (result_or_error.value.is_error())
|
||||
result = result_or_error.value.release_error();
|
||||
else
|
||||
result = result_or_error.frame->registers[0];
|
||||
} else {
|
||||
return ReturnEarly::Yes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user