1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

LibJS: Allow multiple labels on the same statement

Since there are only a number of statements where labels can actually be
used we now also only store labels when necessary.
Also now tracks the first continue usage of a label since this might not
be valid but that can only be determined after we have parsed the
statement.
Also ensures the correct error does not get wiped by load_state.
This commit is contained in:
davidot 2021-09-18 23:01:54 +02:00 committed by Linus Groh
parent bfc1b4ba61
commit 79caca8ca2
7 changed files with 194 additions and 47 deletions

View file

@ -2326,6 +2326,11 @@ void ThrowStatement::dump(int indent) const
argument().dump(indent + 1);
}
void TryStatement::add_label(FlyString string)
{
m_block->add_label(move(string));
}
Value TryStatement::execute(Interpreter& interpreter, GlobalObject& global_object) const
{
InterpreterNodeScope node_scope { interpreter, *this };