diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-20 21:16:30 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-21 09:02:23 +0100 |
commit | 5832de62fe5e2de4f9a65485246df6550aece33f (patch) | |
tree | 485f847a4dedebdcb2b11902bbe0256fa98518ed /Userland/Libraries/LibJS/Runtime/ErrorConstructor.h | |
parent | 0881f8160fd81d8e25b7cc2eff2d64f2aed7ed53 (diff) | |
download | serenity-5832de62fe5e2de4f9a65485246df6550aece33f.zip |
LibJS: Convert NativeFunction::{call,construct}() to ThrowCompletionOr
Both at the same time because many of them call construct() in call()
and I'm not keen on adding a bunch of temporary plumbing to turn
exceptions into throw completions.
Also changes the return value of construct() to Object* instead of Value
as it always needs to return an object; allowing an arbitrary Value is a
massive foot gun.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ErrorConstructor.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ErrorConstructor.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h index 8c37dbb1e2..4226c6107f 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h @@ -19,8 +19,8 @@ public: virtual void initialize(GlobalObject&) override; virtual ~ErrorConstructor() override = default; - virtual Value call() override; - virtual Value construct(FunctionObject& new_target) override; + virtual ThrowCompletionOr<Value> call() override; + virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override; private: virtual bool has_constructor() const override { return true; } @@ -34,8 +34,8 @@ private: explicit ConstructorName(GlobalObject&); \ virtual void initialize(GlobalObject&) override; \ virtual ~ConstructorName() override; \ - virtual Value call() override; \ - virtual Value construct(FunctionObject& new_target) override; \ + virtual ThrowCompletionOr<Value> call() override; \ + virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override; \ \ private: \ virtual bool has_constructor() const override { return true; } \ |