mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:17:34 +00: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
1 changed files with 5 additions and 1 deletions
|
@ -1051,7 +1051,11 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
||||||
|
|
||||||
if (s_run_bytecode) {
|
if (s_run_bytecode) {
|
||||||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter.global_object(), interpreter.realm());
|
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 {
|
} else {
|
||||||
return ReturnEarly::Yes;
|
return ReturnEarly::Yes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue