mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
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.
This commit is contained in:
parent
0881f8160f
commit
5832de62fe
99 changed files with 597 additions and 669 deletions
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
@ -26,8 +27,8 @@ public:
|
|||
|
||||
// Used for [[Call]] / [[Construct]]'s "...result of evaluating F in a manner that conforms to the specification of F".
|
||||
// Needs to be overridden by all NativeFunctions without an m_native_function.
|
||||
virtual Value call();
|
||||
virtual Value construct(FunctionObject& new_target);
|
||||
virtual ThrowCompletionOr<Value> call();
|
||||
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target);
|
||||
|
||||
virtual const FlyString& name() const override { return m_name; };
|
||||
virtual bool is_strict_mode() const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue