1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibJS: Convert ScopeNode declaration functions to ThrowCompletionOr

This removes a number of vm.exception() checks which are now caught
directly by TRY. Make use of these checks in
{Global, Eval}DeclarationInstantiation and while we're here add spec
comments.
This commit is contained in:
davidot 2022-02-07 13:31:01 +01:00 committed by Linus Groh
parent cc7a117f0f
commit 4136cbdb09
6 changed files with 462 additions and 305 deletions

View file

@ -36,12 +36,10 @@ void ScopeNode::generate_bytecode(Bytecode::Generator& generator) const
HashTable<FlyString> functions_initialized;
for_each_var_function_declaration_in_reverse_order([&](FunctionDeclaration const& function) {
if (functions_initialized.set(function.name()) != AK::HashSetResult::InsertedNewEntry)
return IterationDecision::Continue;
return;
generator.emit<Bytecode::Op::NewFunction>(function);
generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(function.name()));
return IterationDecision::Continue;
});
// FIXME: Register lexical and variable scope declarations