1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:17:35 +00:00

LibJS: Allow statements to have multiple labels

This is a curious thing that occurs more often than you'd think in
minified JavaScript:

    a: b: c: for (...) { ... break b; ... }
This commit is contained in:
Andreas Kling 2021-09-26 18:16:06 +02:00
parent ababcc5725
commit 3252d984ae
6 changed files with 31 additions and 21 deletions

View file

@ -193,11 +193,11 @@ public:
m_unwind_until = ScopeType::None;
m_unwind_until_label = {};
}
bool should_unwind_until(ScopeType type, FlyString const& label) const
bool should_unwind_until(ScopeType type, HashTable<FlyString> const& labels) const
{
if (m_unwind_until_label.is_null())
return m_unwind_until == type;
return m_unwind_until == type && m_unwind_until_label == label;
return m_unwind_until == type && labels.contains(m_unwind_until_label);
}
bool should_unwind() const { return m_unwind_until != ScopeType::None; }