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.
This commit is contained in:
Aliaksandr Kalenik 2023-07-04 22:49:07 +03:00 committed by Andreas Kling
parent a627c15b07
commit 75ae368896
Notes: sideshowbarker 2024-07-17 03:35:24 +09:00

View file

@ -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);