mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
LibJS: Add ScopeNode::for_each_var_declared_identifier()
The same as for_each_var_declared_name but for identifiers.
This commit is contained in:
parent
7f0074ac23
commit
401d97c45c
2 changed files with 11 additions and 0 deletions
|
@ -4488,6 +4488,16 @@ ThrowCompletionOr<void> ScopeNode::for_each_var_declared_name(ThrowCompletionOrV
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThrowCompletionOr<void> ScopeNode::for_each_var_declared_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const
|
||||||
|
{
|
||||||
|
for (auto& declaration : m_var_declarations) {
|
||||||
|
TRY(declaration->for_each_bound_identifier([&](auto const& id) {
|
||||||
|
return callback(id);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
ThrowCompletionOr<void> ScopeNode::for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const
|
ThrowCompletionOr<void> ScopeNode::for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const
|
||||||
{
|
{
|
||||||
for (ssize_t i = m_var_declarations.size() - 1; i >= 0; i--) {
|
for (ssize_t i = m_var_declarations.size() - 1; i >= 0; i--) {
|
||||||
|
|
|
@ -310,6 +310,7 @@ public:
|
||||||
ThrowCompletionOr<void> for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const;
|
ThrowCompletionOr<void> for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const;
|
||||||
|
|
||||||
ThrowCompletionOr<void> for_each_var_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const;
|
ThrowCompletionOr<void> for_each_var_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const;
|
||||||
|
ThrowCompletionOr<void> for_each_var_declared_identifier(ThrowCompletionOrVoidCallback<Identifier const&>&& callback) const;
|
||||||
|
|
||||||
ThrowCompletionOr<void> for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const;
|
ThrowCompletionOr<void> for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const;
|
||||||
ThrowCompletionOr<void> for_each_lexical_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const;
|
ThrowCompletionOr<void> for_each_lexical_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue