mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibJS: Remove GlobalObject parameter from native functions
This commit is contained in:
parent
7b990c27a1
commit
b465f46e00
77 changed files with 240 additions and 215 deletions
|
@ -16,7 +16,7 @@ namespace JS {
|
|||
|
||||
// 10.3.3 CreateBuiltinFunction ( behaviour, length, name, additionalInternalSlotsList [ , realm [ , prototype [ , prefix ] ] ] ), https://tc39.es/ecma262/#sec-createbuiltinfunction
|
||||
// NOTE: This doesn't consider additionalInternalSlotsList, which is rarely used, and can either be implemented using only the `function` lambda, or needs a NativeFunction subclass.
|
||||
NativeFunction* NativeFunction::create(Realm& allocating_realm, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> realm, Optional<Object*> prototype, Optional<StringView> const& prefix)
|
||||
NativeFunction* NativeFunction::create(Realm& allocating_realm, Function<ThrowCompletionOr<Value>(VM&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> realm, Optional<Object*> prototype, Optional<StringView> const& prefix)
|
||||
{
|
||||
auto& vm = allocating_realm.vm();
|
||||
|
||||
|
@ -51,12 +51,12 @@ NativeFunction* NativeFunction::create(Realm& allocating_realm, Function<ThrowCo
|
|||
return function;
|
||||
}
|
||||
|
||||
NativeFunction* NativeFunction::create(Realm& realm, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> function)
|
||||
NativeFunction* NativeFunction::create(Realm& realm, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&)> function)
|
||||
{
|
||||
return realm.heap().allocate<NativeFunction>(realm, name, move(function), *realm.global_object().function_prototype());
|
||||
}
|
||||
|
||||
NativeFunction::NativeFunction(Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> native_function, Object* prototype, Realm& realm)
|
||||
NativeFunction::NativeFunction(Function<ThrowCompletionOr<Value>(VM&)> native_function, Object* prototype, Realm& realm)
|
||||
: FunctionObject(realm, prototype)
|
||||
, m_native_function(move(native_function))
|
||||
, m_realm(&realm)
|
||||
|
@ -73,7 +73,7 @@ NativeFunction::NativeFunction(Object& prototype)
|
|||
{
|
||||
}
|
||||
|
||||
NativeFunction::NativeFunction(FlyString name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> native_function, Object& prototype)
|
||||
NativeFunction::NativeFunction(FlyString name, Function<ThrowCompletionOr<Value>(VM&)> native_function, Object& prototype)
|
||||
: FunctionObject(prototype)
|
||||
, m_name(move(name))
|
||||
, m_native_function(move(native_function))
|
||||
|
@ -224,7 +224,7 @@ ThrowCompletionOr<Object*> NativeFunction::internal_construct(MarkedVector<Value
|
|||
|
||||
ThrowCompletionOr<Value> NativeFunction::call()
|
||||
{
|
||||
return m_native_function(vm(), global_object());
|
||||
return m_native_function(vm());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Object*> NativeFunction::construct(FunctionObject&)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue