diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Libraries/LibJS/Runtime/ArrayConstructor.cpp index 6be1953fff..bfaaccd05f 100644 --- a/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -34,6 +34,7 @@ namespace JS { ArrayConstructor::ArrayConstructor() + : NativeFunction("Array") { put("prototype", interpreter().array_prototype()); put("length", Value(1)); diff --git a/Libraries/LibJS/Runtime/BooleanConstructor.cpp b/Libraries/LibJS/Runtime/BooleanConstructor.cpp index c8254abd66..3f5d54a68a 100644 --- a/Libraries/LibJS/Runtime/BooleanConstructor.cpp +++ b/Libraries/LibJS/Runtime/BooleanConstructor.cpp @@ -33,6 +33,7 @@ namespace JS { BooleanConstructor::BooleanConstructor() + : NativeFunction("Boolean") { put("prototype", Value(interpreter().boolean_prototype())); put("length", Value(1)); diff --git a/Libraries/LibJS/Runtime/DateConstructor.cpp b/Libraries/LibJS/Runtime/DateConstructor.cpp index 407c95d38d..9f825a6b96 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -34,6 +34,7 @@ namespace JS { DateConstructor::DateConstructor() + : NativeFunction("Date") { put("prototype", interpreter().date_prototype()); put("length", Value(7)); diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Libraries/LibJS/Runtime/ErrorConstructor.cpp index b62018fe02..082d3d3944 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -31,6 +31,7 @@ namespace JS { ErrorConstructor::ErrorConstructor() + : NativeFunction("Error") { put("prototype", interpreter().error_prototype()); put("length", Value(1)); diff --git a/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Libraries/LibJS/Runtime/FunctionConstructor.cpp index 6a005f8324..fc93e3d13c 100644 --- a/Libraries/LibJS/Runtime/FunctionConstructor.cpp +++ b/Libraries/LibJS/Runtime/FunctionConstructor.cpp @@ -35,6 +35,7 @@ namespace JS { FunctionConstructor::FunctionConstructor() + : NativeFunction("Function") { put("prototype", interpreter().function_prototype()); put("length", Value(1)); diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Libraries/LibJS/Runtime/FunctionPrototype.cpp index 33f36335af..62e6c60068 100644 --- a/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -122,7 +122,11 @@ Value FunctionPrototype::to_string(Interpreter& interpreter) // function_body = body.to_source(); function_body = " ???"; } - auto function_source = String::format("function %s(%s) {\n%s\n}", function_name.characters(), function_parameters.characters(), function_body.characters()); + + auto function_source = String::format("function %s(%s) {\n%s\n}", + function_name.is_null() ? "" : function_name.characters(), + function_parameters.characters(), + function_body.characters()); return js_string(interpreter, function_source); } diff --git a/Libraries/LibJS/Runtime/NativeFunction.cpp b/Libraries/LibJS/Runtime/NativeFunction.cpp index e50988105c..aadf7d8060 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -36,6 +36,11 @@ NativeFunction::NativeFunction(const FlyString& name, AK::Function