LibJS: Set internal function name of NativeError constructors

By using the same NativeFunction constructor as plain ErrorConstructor
and passing the name, TypeError & co. will now include their name in
backtraces and such.
Eventually we should probably rely on [[InitialName]] for this, but for
now that's how it works.
This commit is contained in:
Linus Groh 2022-03-15 14:08:10 +00:00 committed by Andreas Kling
parent 04bb17ca94
commit ecba29c158

View file

@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
ConstructorName::ConstructorName(GlobalObject& global_object) \
: NativeFunction(*static_cast<Object*>(global_object.error_constructor())) \
: NativeFunction(vm().names.ClassName.as_string(), *static_cast<Object*>(global_object.error_constructor())) \
{ \
} \
\