mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibJS: Use new NativeFunction::create() in most places
Resolves one FIXME where we can now pass a realm, and sets the length correctly in a bunch of places that previously didn't. Also reduces the number of "format function name string from arbitrary PropertyKey" implementations, although two more remain present in the AST (used with ECMAScriptFunctionObjects, which is a different beast).
This commit is contained in:
parent
e4f165d460
commit
47cdd90836
9 changed files with 98 additions and 105 deletions
|
@ -63,7 +63,7 @@ ThrowCompletionOr<Value> await(GlobalObject& global_object, Value value)
|
|||
};
|
||||
|
||||
// 4. Let onFulfilled be ! CreateBuiltinFunction(fulfilledClosure, 1, "", « »).
|
||||
auto on_fulfilled = NativeFunction::create(global_object, "", move(fulfilled_closure));
|
||||
auto* on_fulfilled = NativeFunction::create(global_object, move(fulfilled_closure), 1, "");
|
||||
|
||||
// 5. Let rejectedClosure be a new Abstract Closure with parameters (reason) that captures asyncContext and performs the following steps when called:
|
||||
auto rejected_closure = [&success, &result](VM& vm, GlobalObject&) -> ThrowCompletionOr<Value> {
|
||||
|
@ -87,7 +87,7 @@ ThrowCompletionOr<Value> await(GlobalObject& global_object, Value value)
|
|||
};
|
||||
|
||||
// 6. Let onRejected be ! CreateBuiltinFunction(rejectedClosure, 1, "", « »).
|
||||
auto on_rejected = NativeFunction::create(global_object, "", move(rejected_closure));
|
||||
auto* on_rejected = NativeFunction::create(global_object, move(rejected_closure), 1, "");
|
||||
|
||||
// 7. Perform ! PerformPromiseThen(promise, onFulfilled, onRejected).
|
||||
auto* promise = verify_cast<Promise>(promise_object);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue