mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:55:08 +00:00
LibJS: Actually pop frames off of the scope stack when exiting a scope
This commit is contained in:
parent
d52c5a94b4
commit
9494865f99
1 changed files with 5 additions and 2 deletions
|
@ -86,8 +86,11 @@ void Interpreter::enter_scope(const ScopeNode& scope_node, Vector<Argument> argu
|
||||||
|
|
||||||
void Interpreter::exit_scope(const ScopeNode& scope_node)
|
void Interpreter::exit_scope(const ScopeNode& scope_node)
|
||||||
{
|
{
|
||||||
while (m_scope_stack.last().scope_node.ptr() != &scope_node)
|
while (!m_scope_stack.is_empty()) {
|
||||||
m_scope_stack.take_last();
|
auto popped_scope = m_scope_stack.take_last();
|
||||||
|
if (popped_scope.scope_node.ptr() == &scope_node)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If we unwind all the way, just reset m_unwind_until so that future "return" doesn't break.
|
// If we unwind all the way, just reset m_unwind_until so that future "return" doesn't break.
|
||||||
if (m_scope_stack.is_empty())
|
if (m_scope_stack.is_empty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue