mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +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:
parent
ed80952cb6
commit
54c95d44ce
Notes:
sideshowbarker
2024-07-19 07:33:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/54c95d44ce9
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue