1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 06:34:58 +00:00

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

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