mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +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:
parent
03615a7872
commit
d52ea37717
6 changed files with 87 additions and 21 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue