LibJS: Functions with no variables don't need to create environment

Just hand out the parent environment instead.
This commit is contained in:
Andreas Kling 2020-04-15 22:16:55 +02:00
parent ed80952cb6
commit 54c95d44ce
Notes: sideshowbarker 2024-07-19 07:33:54 +09:00

View file

@ -72,7 +72,8 @@ LexicalEnvironment* ScriptFunction::create_environment()
}
}
}
if (variables.is_empty())
return m_parent_environment;
return heap().allocate<LexicalEnvironment>(move(variables), m_parent_environment);
}