LibJS: Don't call shrink_to_fit() on same environment twice in FDI

This commit is contained in:
Andreas Kling 2023-11-27 20:22:20 +01:00
commit 3b6785245f
Notes: sideshowbarker 2024-07-18 03:20:18 +09:00

View file

@ -914,7 +914,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
if (is<DeclarativeEnvironment>(*lex_environment))
static_cast<DeclarativeEnvironment*>(lex_environment.ptr())->shrink_to_fit();
if (is<DeclarativeEnvironment>(*var_environment))
if (lex_environment != var_environment && is<DeclarativeEnvironment>(*var_environment))
static_cast<DeclarativeEnvironment*>(var_environment.ptr())->shrink_to_fit();
// 37. Return unused.