mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-16 16:12:53 +00:00
LibJS: Delete Declaration::for_each_bound_name
We can delete for_each_bound_name() because there is more generic version of this function called for_each_bound_identifier() that gives you identifier using which you can get both name and check if it is local/global.
This commit is contained in:
parent
348e43b36d
commit
231d58dd62
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 231d58dd62
Pull-request: https://github.com/SerenityOS/serenity/pull/20112
2 changed files with 0 additions and 74 deletions
|
@ -2296,14 +2296,6 @@ void ClassDeclaration::dump(int indent) const
|
|||
m_class_expression->dump(indent + 1);
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> ClassDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
if (m_class_expression->name().is_empty())
|
||||
return {};
|
||||
|
||||
return callback(m_class_expression->name());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> ClassDeclaration::for_each_bound_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||
{
|
||||
if (!m_class_expression->m_name)
|
||||
|
@ -2434,23 +2426,6 @@ bool BindingPattern::contains_expression() const
|
|||
return false;
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> BindingPattern::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : entries) {
|
||||
auto const& alias = entry.alias;
|
||||
if (alias.has<NonnullRefPtr<Identifier const>>()) {
|
||||
TRY(callback(alias.get<NonnullRefPtr<Identifier const>>()->string()));
|
||||
} else if (alias.has<NonnullRefPtr<BindingPattern const>>()) {
|
||||
TRY(alias.get<NonnullRefPtr<BindingPattern const>>()->for_each_bound_name(forward<decltype(callback)>(callback)));
|
||||
} else {
|
||||
auto const& name = entry.name;
|
||||
if (name.has<NonnullRefPtr<Identifier const>>())
|
||||
TRY(callback(name.get<NonnullRefPtr<Identifier const>>()->string()));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> BindingPattern::for_each_bound_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : entries) {
|
||||
|
@ -2558,13 +2533,6 @@ void FunctionDeclaration::dump(int indent) const
|
|||
FunctionNode::dump(indent, class_name());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
if (name().is_empty())
|
||||
return {};
|
||||
return callback(name());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||
{
|
||||
if (!m_name)
|
||||
|
@ -3115,23 +3083,6 @@ Completion VariableDeclarator::execute(Interpreter& interpreter) const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : declarations()) {
|
||||
TRY(entry->target().visit(
|
||||
[&](NonnullRefPtr<Identifier const> const& id) {
|
||||
return callback(id->string());
|
||||
},
|
||||
[&](NonnullRefPtr<BindingPattern const> const& binding) {
|
||||
return binding->for_each_bound_identifier([&](auto const& identifier) {
|
||||
return callback(identifier.string());
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> VariableDeclaration::for_each_bound_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : declarations()) {
|
||||
|
@ -3196,16 +3147,6 @@ Completion UsingDeclaration::execute(Interpreter& interpreter) const
|
|||
return normal_completion({});
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> UsingDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : m_declarations) {
|
||||
VERIFY(entry->target().has<NonnullRefPtr<Identifier const>>());
|
||||
TRY(callback(entry->target().get<NonnullRefPtr<Identifier const>>()->string()));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> UsingDeclaration::for_each_bound_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||
{
|
||||
for (auto const& entry : m_declarations) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue