1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:54:57 +00:00

LibJS: Delete Declaration::for_each_var_declared_name

1. Replaces for_each_var_declared_name usage with more generic
for_each_var_declared_identifier.
2. Deletes for_each_var_declared_name.
This commit is contained in:
Aliaksandr Kalenik 2023-07-20 17:00:43 +02:00 committed by Andreas Kling
parent 0fa47405df
commit fb94415f03
5 changed files with 13 additions and 22 deletions

View file

@ -438,8 +438,9 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm)
// 21. For each element d of varDeclarations, do
// a. For each element dn of the BoundNames of d, do
// NOTE: Due to the use of MUST with `create_mutable_binding` and `initialize_binding` below,
// an exception should not result from `for_each_var_declared_name`.
MUST(m_ecmascript_code->for_each_var_declared_name([&](auto const& name) {
// an exception should not result from `for_each_var_declared_identifier`.
MUST(m_ecmascript_code->for_each_var_declared_identifier([&](auto const& identifier) {
auto const& name = identifier.string();
// i. If dn is not an element of declaredVarNames, then
if (!declared_var_names.contains_slow(name)) {
// 1. Perform ! env.CreateMutableBinding(dn, false).