Explorar o código

LibJS: Stop qualifying AK::Function

Now that JS function objects are JS::FunctionObject, we can stop
qualifying AK::Function and just say "Function" everywhere. Nice. :^)
Andreas Kling %!s(int64=4) %!d(string=hai) anos
pai
achega
1bd52ce789

+ 1 - 1
Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp

@@ -19,7 +19,7 @@ void PlaceBlocks::perform(PassPipelineExecutable& executable)
     HashTable<BasicBlock const*> reachable_blocks;
 
     // Visit the blocks in CFG order
-    AK::Function<void(BasicBlock const*)> visit = [&](auto* block) {
+    Function<void(BasicBlock const*)> visit = [&](auto* block) {
         if (reachable_blocks.contains(block))
             return;
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp

@@ -50,7 +50,7 @@ size_t length_of_array_like(GlobalObject& global_object, Object const& object)
 }
 
 // 7.3.19 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike
-MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value value, AK::Function<Result<void, ErrorType>(Value)> check_value)
+MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value value, Function<Result<void, ErrorType>(Value)> check_value)
 {
     auto& vm = global_object.vm();
     auto& heap = global_object.heap();

+ 1 - 1
Userland/Libraries/LibJS/Runtime/AbstractOperations.h

@@ -19,7 +19,7 @@ EnvironmentRecord& get_this_environment(VM&);
 Object* get_super_constructor(VM&);
 Value require_object_coercible(GlobalObject&, Value);
 size_t length_of_array_like(GlobalObject&, Object const&);
-MarkedValueList create_list_from_array_like(GlobalObject&, Value, AK::Function<Result<void, ErrorType>(Value)> = {});
+MarkedValueList create_list_from_array_like(GlobalObject&, Value, Function<Result<void, ErrorType>(Value)> = {});
 FunctionObject* species_constructor(GlobalObject&, Object const&, FunctionObject& default_constructor);
 GlobalObject* get_function_realm(GlobalObject&, FunctionObject const&);
 Object* get_prototype_from_constructor(GlobalObject&, FunctionObject const& constructor, Object* (GlobalObject::*intrinsic_default_prototype)());

+ 1 - 1
Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp

@@ -110,7 +110,7 @@ static FunctionObject* callback_from_args(GlobalObject& global_object, const Str
     return &callback.as_function();
 }
 
-static void for_each_item(VM& vm, GlobalObject& global_object, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
+static void for_each_item(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
 {
     auto* this_object = vm.this_value(global_object).to_object(global_object);
     if (!this_object)

+ 1 - 1
Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp

@@ -143,7 +143,7 @@ MarkedValueList iterable_to_list(GlobalObject& global_object, Value iterable, Va
     return values;
 }
 
-void get_iterator_values(GlobalObject& global_object, Value value, AK::Function<IterationDecision(Value)> callback, Value method, CloseOnAbrupt close_on_abrupt)
+void get_iterator_values(GlobalObject& global_object, Value value, Function<IterationDecision(Value)> callback, Value method, CloseOnAbrupt close_on_abrupt)
 {
     auto& vm = global_object.vm();
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/IteratorOperations.h

@@ -30,6 +30,6 @@ enum class CloseOnAbrupt {
     No,
     Yes
 };
-void get_iterator_values(GlobalObject&, Value value, AK::Function<IterationDecision(Value)> callback, Value method = {}, CloseOnAbrupt close_on_abrupt = CloseOnAbrupt::Yes);
+void get_iterator_values(GlobalObject&, Value value, Function<IterationDecision(Value)> callback, Value method = {}, CloseOnAbrupt close_on_abrupt = CloseOnAbrupt::Yes);
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/NativeFunction.cpp

@@ -10,7 +10,7 @@
 
 namespace JS {
 
-NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyString& name, AK::Function<Value(VM&, GlobalObject&)> function)
+NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyString& name, Function<Value(VM&, GlobalObject&)> function)
 {
     return global_object.heap().allocate<NativeFunction>(global_object, name, move(function), *global_object.function_prototype());
 }
@@ -20,7 +20,7 @@ NativeFunction::NativeFunction(Object& prototype)
 {
 }
 
-NativeFunction::NativeFunction(PropertyName const& name, AK::Function<Value(VM&, GlobalObject&)> native_function, Object& prototype)
+NativeFunction::NativeFunction(PropertyName const& name, Function<Value(VM&, GlobalObject&)> native_function, Object& prototype)
     : FunctionObject(prototype)
     , m_name(name.as_string())
     , m_native_function(move(native_function))

+ 3 - 3
Userland/Libraries/LibJS/Runtime/NativeFunction.h

@@ -15,9 +15,9 @@ class NativeFunction : public FunctionObject {
     JS_OBJECT(NativeFunction, FunctionObject);
 
 public:
-    static NativeFunction* create(GlobalObject&, const FlyString& name, AK::Function<Value(VM&, GlobalObject&)>);
+    static NativeFunction* create(GlobalObject&, const FlyString& name, Function<Value(VM&, GlobalObject&)>);
 
-    explicit NativeFunction(PropertyName const& name, AK::Function<Value(VM&, GlobalObject&)>, Object& prototype);
+    explicit NativeFunction(PropertyName const& name, Function<Value(VM&, GlobalObject&)>, Object& prototype);
     virtual void initialize(GlobalObject&) override { }
     virtual ~NativeFunction() override;
 
@@ -38,7 +38,7 @@ private:
     virtual bool is_native_function() const final { return true; }
 
     FlyString m_name;
-    AK::Function<Value(VM&, GlobalObject&)> m_native_function;
+    Function<Value(VM&, GlobalObject&)> m_native_function;
 };
 
 template<>

+ 1 - 1
Userland/Libraries/LibJS/Runtime/NativeProperty.cpp

@@ -9,7 +9,7 @@
 
 namespace JS {
 
-NativeProperty::NativeProperty(AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<void(VM&, GlobalObject&, Value)> setter)
+NativeProperty::NativeProperty(Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter)
     : m_getter(move(getter))
     , m_setter(move(setter))
 {

+ 3 - 3
Userland/Libraries/LibJS/Runtime/NativeProperty.h

@@ -13,7 +13,7 @@ namespace JS {
 
 class NativeProperty final : public Cell {
 public:
-    NativeProperty(AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<void(VM&, GlobalObject&, Value)> setter);
+    NativeProperty(Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter);
     virtual ~NativeProperty() override;
 
     Value get(VM&, GlobalObject&) const;
@@ -22,8 +22,8 @@ public:
 private:
     virtual const char* class_name() const override { return "NativeProperty"; }
 
-    AK::Function<Value(VM&, GlobalObject&)> m_getter;
-    AK::Function<void(VM&, GlobalObject&, Value)> m_setter;
+    Function<Value(VM&, GlobalObject&)> m_getter;
+    Function<void(VM&, GlobalObject&, Value)> m_setter;
 };
 
 }

+ 3 - 3
Userland/Libraries/LibJS/Runtime/Object.cpp

@@ -555,7 +555,7 @@ bool Object::define_property(const PropertyName& property_name, Value value, Pro
     return put_own_property(property_name.to_string_or_symbol(), value, attributes, PutOwnPropertyMode::DefineProperty, throw_exceptions);
 }
 
-bool Object::define_native_accessor(PropertyName const& property_name, AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attribute)
+bool Object::define_native_accessor(PropertyName const& property_name, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attribute)
 {
     auto& vm = this->vm();
     String formatted_property_name;
@@ -990,7 +990,7 @@ bool Object::put(const PropertyName& property_name, Value value, Value receiver)
     return put_own_property(string_or_symbol, value, default_attributes, PutOwnPropertyMode::Put, vm().in_strict_mode());
 }
 
-bool Object::define_native_function(PropertyName const& property_name, AK::Function<Value(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute)
+bool Object::define_native_function(PropertyName const& property_name, Function<Value(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute)
 {
     auto& vm = this->vm();
     String function_name;
@@ -1009,7 +1009,7 @@ bool Object::define_native_function(PropertyName const& property_name, AK::Funct
     return define_property(property_name, function, attribute);
 }
 
-bool Object::define_native_property(PropertyName const& property_name, AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attribute)
+bool Object::define_native_property(PropertyName const& property_name, Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attribute)
 {
     return define_property(property_name, heap().allocate_without_global_object<NativeProperty>(move(getter), move(setter)), attribute);
 }

+ 3 - 3
Userland/Libraries/LibJS/Runtime/Object.h

@@ -93,9 +93,9 @@ public:
     bool define_property_without_transition(const PropertyName&, Value value, PropertyAttributes attributes = default_attributes, bool throw_exceptions = true);
     bool define_accessor(const PropertyName&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes = default_attributes, bool throw_exceptions = true);
 
-    bool define_native_function(PropertyName const&, AK::Function<Value(VM&, GlobalObject&)>, i32 length = 0, PropertyAttributes attributes = default_attributes);
-    bool define_native_property(PropertyName const&, AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attributes = default_attributes);
-    bool define_native_accessor(PropertyName const&, AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes = default_attributes);
+    bool define_native_function(PropertyName const&, Function<Value(VM&, GlobalObject&)>, i32 length = 0, PropertyAttributes attributes = default_attributes);
+    bool define_native_property(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attributes = default_attributes);
+    bool define_native_accessor(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes = default_attributes);
 
     void define_properties(Value properties);
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.h

@@ -25,7 +25,7 @@ class PromiseResolvingFunction final : public NativeFunction {
     JS_OBJECT(PromiseResolvingFunction, NativeFunction);
 
 public:
-    using FunctionType = AK::Function<Value(VM&, GlobalObject&, Promise&, AlreadyResolved&)>;
+    using FunctionType = Function<Value(VM&, GlobalObject&, Promise&, AlreadyResolved&)>;
 
     static PromiseResolvingFunction* create(GlobalObject&, Promise&, AlreadyResolved&, FunctionType);
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp

@@ -80,7 +80,7 @@ static FunctionObject* callback_from_args(GlobalObject& global_object, const Str
     return &callback.as_function();
 }
 
-static void for_each_item(VM& vm, GlobalObject& global_object, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
+static void for_each_item(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
 {
     auto* typed_array = typed_array_from(vm, global_object);
     if (!typed_array)

+ 3 - 3
Userland/Libraries/LibJS/Runtime/VM.h

@@ -252,9 +252,9 @@ public:
 
     void promise_rejection_tracker(const Promise&, Promise::RejectionOperation) const;
 
-    AK::Function<void()> on_call_stack_emptied;
-    AK::Function<void(const Promise&)> on_promise_unhandled_rejection;
-    AK::Function<void(const Promise&)> on_promise_rejection_handled;
+    Function<void()> on_call_stack_emptied;
+    Function<void(const Promise&)> on_promise_unhandled_rejection;
+    Function<void(const Promise&)> on_promise_rejection_handled;
 
 private:
     VM();