diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-17 19:31:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-18 10:28:22 +0200 |
commit | 205ac0090da21c593ac7cef7db348412e4f52168 (patch) | |
tree | 9b1d0532af723658f66dc61a99b738a3156c3816 /Libraries/LibJS/Runtime/ErrorConstructor.cpp | |
parent | 0df4d2823a0721668dfefbff68a49070c1a1bf0f (diff) | |
download | serenity-205ac0090da21c593ac7cef7db348412e4f52168.zip |
LibJS: Pass prototype to Error constructors
Diffstat (limited to 'Libraries/LibJS/Runtime/ErrorConstructor.cpp')
-rw-r--r-- | Libraries/LibJS/Runtime/ErrorConstructor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 082d3d3944..3932911d8d 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -51,7 +51,7 @@ Value ErrorConstructor::construct(Interpreter& interpreter) String message = ""; if (!interpreter.call_frame().arguments.is_empty() && !interpreter.call_frame().arguments[0].is_undefined()) message = interpreter.call_frame().arguments[0].to_string(); - return interpreter.heap().allocate<Error>("Error", message); + return Error::create(interpreter.global_object(), "Error", message); } #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ @@ -70,7 +70,7 @@ Value ErrorConstructor::construct(Interpreter& interpreter) String message = ""; \ if (!interpreter.call_frame().arguments.is_empty() && !interpreter.call_frame().arguments[0].is_undefined()) \ message = interpreter.call_frame().arguments[0].to_string(); \ - return interpreter.heap().allocate<ClassName>(message); \ + return ClassName::create(interpreter.global_object(), message); \ } JS_ENUMERATE_ERROR_SUBCLASSES |