summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-02-09 19:19:26 +0000
committerLinus Groh <mail@linusgroh.de>2022-02-09 23:31:34 +0000
commitf663c7d6da116454b8b49d999474141afd156b0a (patch)
tree7a45439460e76fef659c021e06c52313ec5797c5 /Userland/Libraries/LibJS/Runtime
parentc6c3e2a7fd5970984e521a420bf25a48ecc9171e (diff)
downloadserenity-f663c7d6da116454b8b49d999474141afd156b0a.zip
LibJS: Remove unused BoundFunction::m_constructor_prototype
This was not being used anywhere, and the way we determined it was not matching the spec at all, so let's remove it and do it properly.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r--Userland/Libraries/LibJS/Runtime/BoundFunction.cpp5
-rw-r--r--Userland/Libraries/LibJS/Runtime/BoundFunction.h3
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionObject.cpp7
3 files changed, 3 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
index 9321f28729..dae5079bab 100644
--- a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
@@ -11,12 +11,11 @@
namespace JS {
-BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, i32 length, Object* constructor_prototype)
+BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, i32 length)
: FunctionObject(*global_object.function_prototype())
, m_bound_target_function(&bound_target_function)
, m_bound_this(bound_this)
, m_bound_arguments(move(bound_arguments))
- , m_constructor_prototype(constructor_prototype)
, m_name(String::formatted("bound {}", bound_target_function.name()))
, m_length(length)
{
@@ -88,8 +87,6 @@ void BoundFunction::visit_edges(Visitor& visitor)
visitor.visit(m_bound_this);
for (auto argument : m_bound_arguments)
visitor.visit(argument);
-
- visitor.visit(m_constructor_prototype);
}
}
diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.h b/Userland/Libraries/LibJS/Runtime/BoundFunction.h
index 0069befe4e..5afb692e16 100644
--- a/Userland/Libraries/LibJS/Runtime/BoundFunction.h
+++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.h
@@ -14,7 +14,7 @@ class BoundFunction final : public FunctionObject {
JS_OBJECT(BoundFunction, FunctionObject);
public:
- BoundFunction(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, i32 length, Object* constructor_prototype);
+ BoundFunction(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, i32 length);
virtual void initialize(GlobalObject&) override;
virtual ~BoundFunction();
@@ -36,7 +36,6 @@ private:
Value m_bound_this; // [[BoundThis]]
Vector<Value> m_bound_arguments; // [[BoundArguments]]
- Object* m_constructor_prototype { nullptr };
FlyString m_name;
i32 m_length { 0 };
};
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
index 1dd175d2e2..f7a448b5a4 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionObject.cpp
@@ -117,17 +117,12 @@ ThrowCompletionOr<BoundFunction*> FunctionObject::bind(Value bound_this_value, V
if (length_property.is_number())
computed_length = max(0, length_property.as_i32() - static_cast<i32>(arguments.size()));
- Object* constructor_prototype = nullptr;
- auto prototype_property = TRY(target_function.get(vm.names.prototype));
- if (prototype_property.is_object())
- constructor_prototype = &prototype_property.as_object();
-
Vector<Value> all_bound_arguments;
if (is<BoundFunction>(*this))
all_bound_arguments.extend(static_cast<BoundFunction&>(*this).bound_arguments());
all_bound_arguments.extend(move(arguments));
- return heap().allocate<BoundFunction>(global_object(), global_object(), target_function, bound_this_object, move(all_bound_arguments), computed_length, constructor_prototype);
+ return heap().allocate<BoundFunction>(global_object(), global_object(), target_function, bound_this_object, move(all_bound_arguments), computed_length);
}
}