From ad6ede7ee4aa796eeb0af1218d958b8f9de405b0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Mar 2020 12:27:15 +0100 Subject: [PATCH] LibJS: Make FunctionDeclaration return undefined FunctionExpression returns a JS::Function, while FunctionDeclaration declares one in the relevant scope. --- Libraries/LibJS/AST.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index d8af41531c..c451014084 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -47,7 +47,7 @@ Value FunctionDeclaration::execute(Interpreter& interpreter) const { auto* function = interpreter.heap().allocate(body(), parameters()); interpreter.set_variable(name(), function); - return function; + return {}; } Value FunctionExpression::execute(Interpreter& interpreter) const