mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-31 13:48:25 +00:00
LibJS: Integrate labels into the Interpreter
The interpreter now considers a statement or block's label when considering whether or not to break. All statements can be labelled.
This commit is contained in:
committed by
Andreas Kling
parent
03615a7872
commit
d52ea37717
@@ -72,8 +72,11 @@ Value Interpreter::run(const Statement& statement, ArgumentVector arguments, Sco
|
||||
m_last_value = js_undefined();
|
||||
for (auto& node : block.children()) {
|
||||
m_last_value = node.execute(*this);
|
||||
if (m_unwind_until != ScopeType::None)
|
||||
if (should_unwind()) {
|
||||
if (should_unwind_until(ScopeType::Breakable, block.label()))
|
||||
stop_unwind();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool did_return = m_unwind_until == ScopeType::Function;
|
||||
|
||||
Reference in New Issue
Block a user