mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:38:12 +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
|
@ -457,7 +457,7 @@ ThrowCompletionOr<void> CyclicModule::execute_async_module(VM& vm)
|
|||
};
|
||||
|
||||
// 5. Let onFulfilled be ! CreateBuiltinFunction(fulfilledClosure, 0, "", « »).
|
||||
auto* on_fulfilled = NativeFunction::create(global_object, "", move(fulfilled_closure));
|
||||
auto* on_fulfilled = NativeFunction::create(global_object, move(fulfilled_closure), 0, "");
|
||||
|
||||
// 6. Let rejectedClosure be a new Abstract Closure with parameters (error) that captures module and performs the following steps when called:
|
||||
auto rejected_closure = [&](VM& vm, GlobalObject&) -> ThrowCompletionOr<Value> {
|
||||
|
@ -470,8 +470,8 @@ ThrowCompletionOr<void> CyclicModule::execute_async_module(VM& vm)
|
|||
return js_undefined();
|
||||
};
|
||||
|
||||
auto* on_rejected = NativeFunction::create(global_object, "", move(rejected_closure));
|
||||
// 7. Let onRejected be ! CreateBuiltinFunction(rejectedClosure, 0, "", « »).
|
||||
auto* on_rejected = NativeFunction::create(global_object, move(rejected_closure), 0, "");
|
||||
|
||||
VERIFY(is<Promise>(*capability.promise));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue