mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:37:34 +00:00
LibJS: Reset Bytecode::Interpreter's m_return_value when leaving run()
Otherwise it will cause complete unwind since all parent run() loops will see the same m_return_value being non-empty and break out.
This commit is contained in:
parent
9330163b0b
commit
845f2826aa
1 changed files with 4 additions and 3 deletions
|
@ -77,16 +77,17 @@ Value Interpreter::run(Bytecode::Block const& block)
|
||||||
|
|
||||||
m_register_windows.take_last();
|
m_register_windows.take_last();
|
||||||
|
|
||||||
m_return_value = m_return_value.value_or(js_undefined());
|
auto return_value = m_return_value.value_or(js_undefined());
|
||||||
|
m_return_value = {};
|
||||||
|
|
||||||
// NOTE: The return value from a called function is put into $0 in the caller context.
|
// NOTE: The return value from a called function is put into $0 in the caller context.
|
||||||
if (!m_register_windows.is_empty())
|
if (!m_register_windows.is_empty())
|
||||||
m_register_windows.last()[0] = m_return_value;
|
m_register_windows.last()[0] = return_value;
|
||||||
|
|
||||||
if (vm().call_stack().size() == 1)
|
if (vm().call_stack().size() == 1)
|
||||||
vm().pop_call_frame();
|
vm().pop_call_frame();
|
||||||
|
|
||||||
return m_return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue