1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Remove Interpreter::declare_variable()

Since declarations are now hoisted and handled on scope entry, the job
of a VariableDeclaration becomes to actually initialize variables.

As such, we can remove the part where we insert variables into the
nearest relevant scope. Less work == more speed! :^)
This commit is contained in:
Andreas Kling 2020-04-13 16:45:51 +02:00
parent ac7459cb40
commit 062d6af16e
3 changed files with 0 additions and 23 deletions

View file

@ -828,7 +828,6 @@ void UpdateExpression::dump(int indent) const
Value VariableDeclaration::execute(Interpreter& interpreter) const
{
for (auto& declarator : m_declarations) {
interpreter.declare_variable(declarator.id().string(), m_declaration_kind);
if (auto* init = declarator.init()) {
auto initalizer_result = init->execute(interpreter);
if (interpreter.exception())