Skip to content

Commit

Permalink
LibJS: Functions with no variables don't need to create environment
Browse files Browse the repository at this point in the history
Just hand out the parent environment instead.
  • Loading branch information
awesomekling committed Apr 15, 2020
1 parent ed80952 commit 54c95d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libraries/LibJS/Runtime/ScriptFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 54c95d4

Please sign in to comment.