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

LibJS: Delete Declaration::for_each_lexically_declared_name

1. Replaces for_each_lexically_declared_name usage with more generic
for_each_lexically_declared_identifier.
2. Deletes for_each_lexically_declared_name.
This commit is contained in:
Aliaksandr Kalenik 2023-07-20 16:54:20 +02:00 committed by Andreas Kling
parent 231d58dd62
commit 0fa47405df
4 changed files with 7 additions and 18 deletions

View file

@ -762,8 +762,8 @@ void Parser::parse_module(Program& program)
auto const& exported_name = entry.local_or_import_name;
bool found = false;
// NOTE: Nothing in the callback throws an exception.
MUST(program.for_each_lexically_declared_name([&](auto const& name) {
if (name == exported_name)
MUST(program.for_each_lexically_declared_identifier([&](auto const& identifier) {
if (identifier.string() == exported_name)
found = true;
}));
if (found)
@ -3706,9 +3706,9 @@ NonnullRefPtr<CatchClause const> Parser::parse_catch_clause()
auto body = parse_block_statement();
// NOTE: Nothing in the callback throws an exception.
MUST(body->for_each_lexically_declared_name([&](auto const& name) {
if (bound_names.contains(name))
syntax_error(DeprecatedString::formatted("Identifier '{}' already declared as catch parameter", name));
MUST(body->for_each_lexically_declared_identifier([&](auto const& identifier) {
if (bound_names.contains(identifier.string()))
syntax_error(DeprecatedString::formatted("Identifier '{}' already declared as catch parameter", identifier.string()));
}));
if (pattern_parameter) {