Procházet zdrojové kódy

LibJS: Make FunctionDeclaration return undefined

FunctionExpression returns a JS::Function, while FunctionDeclaration
declares one in the relevant scope.
Andreas Kling před 5 roky
rodič
revize
ad6ede7ee4
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      Libraries/LibJS/AST.cpp

+ 1 - 1
Libraries/LibJS/AST.cpp

@@ -47,7 +47,7 @@ Value FunctionDeclaration::execute(Interpreter& interpreter) const
 {
     auto* function = interpreter.heap().allocate<ScriptFunction>(body(), parameters());
     interpreter.set_variable(name(), function);
-    return function;
+    return {};
 }
 
 Value FunctionExpression::execute(Interpreter& interpreter) const