From 75ae368896d4b2b139dd17d59c7f259824a3fb8d Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Tue, 4 Jul 2023 22:49:07 +0300 Subject: [PATCH] LibJS: Propagate "contains await" flag to parent scope in ScopePusher The flag indicating the presence of an await expression should be passed up to the parent scope until the nearest function scope is reached. This resolves several problems related to identifying top-level awaits, which are currently not recognized correctly when used within a nested scope. --- Userland/Libraries/LibJS/Parser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index a03a560a59..518275399d 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -244,6 +244,7 @@ public: if (m_parent_scope && !m_function_parameters.has_value()) { m_parent_scope->m_contains_access_to_arguments_object |= m_contains_access_to_arguments_object; m_parent_scope->m_contains_direct_call_to_eval |= m_contains_direct_call_to_eval; + m_parent_scope->m_contains_await_expression |= m_contains_await_expression; } VERIFY(m_parser.m_state.current_scope_pusher == this);