浏览代码

LibJS: Make FunctionDeclaration return undefined

FunctionExpression returns a JS::Function, while FunctionDeclaration
declares one in the relevant scope.
Andreas Kling 5 年之前
父节点
当前提交
ad6ede7ee4
共有 1 个文件被更改,包括 1 次插入1 次删除
  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