Libraries: Use default constructors/destructors in LibJS

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
This commit is contained in:
Lenny Maiorani 2022-03-14 10:25:06 -06:00 committed by Linus Groh
parent 07c7827dee
commit d00b79568f
Notes: sideshowbarker 2024-07-18 01:43:16 +09:00
192 changed files with 104 additions and 492 deletions

View file

@ -46,7 +46,7 @@ create_ast_node(SourceRange range, Args&&... args)
class ASTNode : public RefCounted<ASTNode> {
public:
virtual ~ASTNode() { }
virtual ~ASTNode() = default;
virtual Completion execute(Interpreter&, GlobalObject&) const = 0;
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const;
virtual void dump(int indent) const;

View file

@ -19,10 +19,6 @@ Generator::Generator()
{
}
Generator::~Generator()
{
}
CodeGenerationErrorOr<NonnullOwnPtr<Executable>> Generator::generate(ASTNode const& node, FunctionKind enclosing_function_kind)
{
Generator generator;

View file

@ -194,7 +194,7 @@ public:
private:
Generator();
~Generator();
~Generator() = default;
void grow(size_t);
void* next_slot();

View file

@ -17,10 +17,6 @@
namespace JS {
BlockAllocator::BlockAllocator()
{
}
BlockAllocator::~BlockAllocator()
{
for (auto* block : m_blocks) {

View file

@ -13,7 +13,7 @@ namespace JS {
class BlockAllocator {
public:
BlockAllocator();
BlockAllocator() = default;
~BlockAllocator();
void* allocate_block(char const* name);

View file

@ -19,7 +19,7 @@ class Cell {
public:
virtual void initialize(GlobalObject&) { }
virtual ~Cell() { }
virtual ~Cell() = default;
bool is_marked() const { return m_mark; }
void set_marked(bool b) { m_mark = b; }
@ -55,7 +55,7 @@ public:
VM& vm() const;
protected:
Cell() { }
Cell() = default;
private:
bool m_mark : 1 { false };

View file

@ -173,7 +173,7 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
class MarkingVisitor final : public Cell::Visitor {
public:
MarkingVisitor() { }
MarkingVisitor() = default;
virtual void visit_impl(Cell& cell) override
{

View file

@ -36,10 +36,6 @@ Interpreter::Interpreter(VM& vm)
{
}
Interpreter::~Interpreter()
{
}
// 16.1.6 ScriptEvaluation ( scriptRecord ), https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation
ThrowCompletionOr<Value> Interpreter::run(Script& script_record)
{

View file

@ -101,7 +101,7 @@ public:
static NonnullOwnPtr<Interpreter> create_with_existing_realm(Realm&);
~Interpreter();
~Interpreter() = default;
ThrowCompletionOr<Value> run(Script&);
ThrowCompletionOr<Value> run(SourceTextModule&);

View file

@ -17,10 +17,6 @@ Module::Module(Realm& realm, String filename)
{
}
Module::~Module()
{
}
// 16.2.1.5.1.1 InnerModuleLinking ( module, stack, index ), https://tc39.es/ecma262/#sec-InnerModuleLinking
ThrowCompletionOr<u32> Module::inner_module_linking(VM& vm, Vector<Module*>&, u32 index)
{

View file

@ -59,7 +59,7 @@ class Module
: public RefCounted<Module>
, public Weakable<Module> {
public:
virtual ~Module();
virtual ~Module() = default;
Realm& realm() { return *m_realm.cell(); }
Realm const& realm() const { return *m_realm.cell(); }

View file

@ -23,10 +23,6 @@ void ArgumentsObject::initialize(GlobalObject& global_object)
m_parameter_map = Object::create(global_object, nullptr);
}
ArgumentsObject::~ArgumentsObject()
{
}
void ArgumentsObject::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -19,7 +19,7 @@ public:
ArgumentsObject(GlobalObject&, Environment&);
virtual void initialize(GlobalObject&) override;
virtual ~ArgumentsObject() override;
virtual ~ArgumentsObject() override = default;
Environment& environment() { return m_environment; }

View file

@ -52,10 +52,6 @@ Array::Array(Object& prototype)
{
}
Array::~Array()
{
}
// 10.4.2.4 ArraySetLength ( A, Desc ), https://tc39.es/ecma262/#sec-arraysetlength
ThrowCompletionOr<bool> Array::set_length(PropertyDescriptor const& property_descriptor)
{

View file

@ -35,7 +35,7 @@ public:
}
explicit Array(Object& prototype);
virtual ~Array() override;
virtual ~Array() override = default;
virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override;
virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override;

View file

@ -44,10 +44,6 @@ ArrayBuffer::ArrayBuffer(ByteBuffer* buffer, Object& prototype)
{
}
ArrayBuffer::~ArrayBuffer()
{
}
// 1.1.5 IsResizableArrayBuffer ( arrayBuffer ), https://tc39.es/proposal-resizablearraybuffer/#sec-isresizablearraybuffer
bool ArrayBuffer::is_resizable_array_buffer() const
{

View file

@ -31,7 +31,7 @@ public:
ArrayBuffer(ByteBuffer buffer, Object& prototype);
ArrayBuffer(ByteBuffer* buffer, Object& prototype);
virtual ~ArrayBuffer() override;
virtual ~ArrayBuffer() override = default;
size_t byte_length() const { return buffer_impl().size(); }
size_t max_byte_length() const { return m_max_byte_length.value(); } // Will VERIFY() that it has value

View file

@ -36,10 +36,6 @@ void ArrayBufferConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
ArrayBufferConstructor::~ArrayBufferConstructor()
{
}
// 25.1.3.1 ArrayBuffer ( length ), https://tc39.es/ecma262/#sec-arraybuffer-length
ThrowCompletionOr<Value> ArrayBufferConstructor::call()
{

View file

@ -16,7 +16,7 @@ class ArrayBufferConstructor final : public NativeFunction {
public:
explicit ArrayBufferConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ArrayBufferConstructor() override;
virtual ~ArrayBufferConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -35,10 +35,6 @@ void ArrayBufferPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable);
}
ArrayBufferPrototype::~ArrayBufferPrototype()
{
}
// 25.1.5.3 ArrayBuffer.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice)
{

View file

@ -17,7 +17,7 @@ class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype,
public:
explicit ArrayBufferPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ArrayBufferPrototype() override;
virtual ~ArrayBufferPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(slice);

View file

@ -21,10 +21,6 @@ ArrayConstructor::ArrayConstructor(GlobalObject& global_object)
{
}
ArrayConstructor::~ArrayConstructor()
{
}
void ArrayConstructor::initialize(GlobalObject& global_object)
{
auto& vm = this->vm();

View file

@ -16,7 +16,7 @@ class ArrayConstructor final : public NativeFunction {
public:
explicit ArrayConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ArrayConstructor() override;
virtual ~ArrayConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -21,10 +21,6 @@ ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, O
{
}
ArrayIterator::~ArrayIterator()
{
}
void ArrayIterator::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -17,7 +17,7 @@ public:
static ArrayIterator* create(GlobalObject&, Value array, Object::PropertyKind iteration_kind);
explicit ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype);
virtual ~ArrayIterator() override;
virtual ~ArrayIterator() override = default;
Value array() const { return m_array; }
Object::PropertyKind iteration_kind() const { return m_iteration_kind; }

View file

@ -30,10 +30,6 @@ void ArrayIteratorPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Array Iterator"), Attribute::Configurable);
}
ArrayIteratorPrototype::~ArrayIteratorPrototype()
{
}
// 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
// FIXME: This seems to be CreateArrayIterator (https://tc39.es/ecma262/#sec-createarrayiterator) instead of %ArrayIteratorPrototype%.next.
JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next)

View file

@ -17,7 +17,7 @@ class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototy
public:
ArrayIteratorPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ArrayIteratorPrototype() override;
virtual ~ArrayIteratorPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(next);

View file

@ -105,10 +105,6 @@ void ArrayPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_unscopables(), unscopable_list, Attribute::Configurable);
}
ArrayPrototype::~ArrayPrototype()
{
}
// 10.4.2.3 ArraySpeciesCreate ( originalArray, length ), https://tc39.es/ecma262/#sec-arrayspeciescreate
static ThrowCompletionOr<Object*> array_species_create(GlobalObject& global_object, Object& original_array, size_t length)
{

View file

@ -17,7 +17,7 @@ class ArrayPrototype final : public Array {
public:
ArrayPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ArrayPrototype() override;
virtual ~ArrayPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(filter);

View file

@ -60,10 +60,6 @@ ThrowCompletionOr<Value> AsyncFunctionDriverWrapper::react_to_async_task_complet
return promise->perform_then(m_on_fulfillment, m_on_rejection, PromiseCapability { promise, m_on_fulfillment, m_on_rejection });
}
AsyncFunctionDriverWrapper::~AsyncFunctionDriverWrapper()
{
}
void AsyncFunctionDriverWrapper::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -21,7 +21,7 @@ public:
static ThrowCompletionOr<Value> create(GlobalObject&, GeneratorObject*);
explicit AsyncFunctionDriverWrapper(GlobalObject&, GeneratorObject*);
virtual ~AsyncFunctionDriverWrapper() override;
virtual ~AsyncFunctionDriverWrapper() override = default;
void visit_edges(Cell::Visitor&) override;
ThrowCompletionOr<Value> react_to_async_task_completion(VM&, GlobalObject&, Value, bool is_successful);

View file

@ -17,10 +17,6 @@ BigInt::BigInt(Crypto::SignedBigInteger big_integer)
VERIFY(!m_big_integer.is_invalid());
}
BigInt::~BigInt()
{
}
BigInt* js_bigint(Heap& heap, Crypto::SignedBigInteger big_integer)
{
return heap.allocate_without_global_object<BigInt>(move(big_integer));

View file

@ -14,7 +14,7 @@ namespace JS {
class BigInt final : public Cell {
public:
explicit BigInt(Crypto::SignedBigInteger);
virtual ~BigInt();
virtual ~BigInt() override = default;
const Crypto::SignedBigInteger& big_integer() const { return m_big_integer; }
const String to_string() const { return String::formatted("{}n", m_big_integer.to_base(10)); }

View file

@ -37,10 +37,6 @@ void BigIntConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
BigIntConstructor::~BigIntConstructor()
{
}
// 21.2.1.1 BigInt ( value ), https://tc39.es/ecma262/#sec-bigint-constructor-number-value
ThrowCompletionOr<Value> BigIntConstructor::call()
{

View file

@ -16,7 +16,7 @@ class BigIntConstructor final : public NativeFunction {
public:
explicit BigIntConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~BigIntConstructor() override;
virtual ~BigIntConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -20,10 +20,6 @@ BigIntObject::BigIntObject(BigInt& bigint, Object& prototype)
{
}
BigIntObject::~BigIntObject()
{
}
void BigIntObject::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -18,7 +18,7 @@ public:
static BigIntObject* create(GlobalObject&, BigInt&);
BigIntObject(BigInt&, Object& prototype);
virtual ~BigIntObject();
virtual ~BigIntObject() override = default;
BigInt const& bigint() const { return m_bigint; }
BigInt& bigint() { return m_bigint; }

View file

@ -35,10 +35,6 @@ void BigIntPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.BigInt.as_string()), Attribute::Configurable);
}
BigIntPrototype::~BigIntPrototype()
{
}
// thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue
static ThrowCompletionOr<BigInt*> this_bigint_value(GlobalObject& global_object, Value value)
{

View file

@ -16,7 +16,7 @@ class BigIntPrototype final : public Object {
public:
explicit BigIntPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~BigIntPrototype() override;
virtual ~BigIntPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(to_string);

View file

@ -27,10 +27,6 @@ void BooleanConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
BooleanConstructor::~BooleanConstructor()
{
}
// 20.3.1.1 Boolean ( value ), https://tc39.es/ecma262/#sec-boolean-constructor-boolean-value
ThrowCompletionOr<Value> BooleanConstructor::call()
{

View file

@ -16,7 +16,7 @@ class BooleanConstructor final : public NativeFunction {
public:
explicit BooleanConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~BooleanConstructor() override;
virtual ~BooleanConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -19,9 +19,4 @@ BooleanObject::BooleanObject(bool value, Object& prototype)
, m_value(value)
{
}
BooleanObject::~BooleanObject()
{
}
}

View file

@ -16,7 +16,7 @@ public:
static BooleanObject* create(GlobalObject&, bool);
BooleanObject(bool, Object& prototype);
virtual ~BooleanObject() override;
virtual ~BooleanObject() override = default;
bool boolean() const { return m_value; }

View file

@ -26,10 +26,6 @@ void BooleanPrototype::initialize(GlobalObject& global_object)
define_native_function(vm.names.valueOf, value_of, 0, attr);
}
BooleanPrototype::~BooleanPrototype()
{
}
// 20.3.3.2 Boolean.prototype.toString ( ), https://tc39.es/ecma262/#sec-boolean.prototype.tostring
JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
{

View file

@ -16,7 +16,7 @@ class BooleanPrototype final : public BooleanObject {
public:
explicit BooleanPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~BooleanPrototype() override;
virtual ~BooleanPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(to_string);

View file

@ -42,10 +42,6 @@ BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_
{
}
BoundFunction::~BoundFunction()
{
}
// 10.4.1.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-bound-function-exotic-objects-call-thisargument-argumentslist
ThrowCompletionOr<Value> BoundFunction::internal_call([[maybe_unused]] Value this_argument, MarkedVector<Value> arguments_list)
{

View file

@ -18,7 +18,7 @@ public:
static ThrowCompletionOr<BoundFunction*> create(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments);
BoundFunction(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype);
virtual ~BoundFunction();
virtual ~BoundFunction() override = default;
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override;

View file

@ -40,10 +40,6 @@ void ConsoleObject::initialize(GlobalObject& global_object)
define_native_function(vm.names.timeEnd, time_end, 0, attr);
}
ConsoleObject::~ConsoleObject()
{
}
// 1.1.6. log(...data), https://console.spec.whatwg.org/#log
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::log)
{

View file

@ -16,7 +16,7 @@ class ConsoleObject final : public Object {
public:
explicit ConsoleObject(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~ConsoleObject() override;
virtual ~ConsoleObject() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(log);

View file

@ -21,10 +21,6 @@ DataView::DataView(ArrayBuffer* viewed_buffer, size_t byte_length, size_t byte_o
{
}
DataView::~DataView()
{
}
void DataView::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -19,7 +19,7 @@ public:
static DataView* create(GlobalObject&, ArrayBuffer*, size_t byte_length, size_t byte_offset);
explicit DataView(ArrayBuffer*, size_t byte_length, size_t byte_offset, Object& prototype);
virtual ~DataView() override;
virtual ~DataView() override = default;
ArrayBuffer* viewed_array_buffer() const { return m_viewed_array_buffer; }
size_t byte_length() const { return m_byte_length; }

View file

@ -28,10 +28,6 @@ void DataViewConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
DataViewConstructor::~DataViewConstructor()
{
}
// 25.3.2.1 DataView ( buffer [ , byteOffset [ , byteLength ] ] ), https://tc39.es/ecma262/#sec-dataview-buffer-byteoffset-bytelength
ThrowCompletionOr<Value> DataViewConstructor::call()
{

View file

@ -16,7 +16,7 @@ class DataViewConstructor final : public NativeFunction {
public:
explicit DataViewConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~DataViewConstructor() override;
virtual ~DataViewConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject&) override;

View file

@ -50,10 +50,6 @@ void DataViewPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.DataView.as_string()), Attribute::Configurable);
}
DataViewPrototype::~DataViewPrototype()
{
}
// 25.3.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type ), https://tc39.es/ecma262/#sec-getviewvalue
template<typename T>
static ThrowCompletionOr<Value> get_view_value(GlobalObject& global_object, Value request_index, Value is_little_endian)

View file

@ -17,7 +17,7 @@ class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataVi
public:
DataViewPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~DataViewPrototype() override;
virtual ~DataViewPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(get_big_int_64);

View file

@ -28,10 +28,6 @@ Date::Date(double date_value, Object& prototype)
{
}
Date::~Date()
{
}
String Date::iso_date_string() const
{
int year = year_from_time(m_date_value);

View file

@ -19,7 +19,7 @@ public:
static Date* now(GlobalObject&);
Date(double date_value, Object& prototype);
virtual ~Date() override;
virtual ~Date() override = default;
double date_value() const { return m_date_value; }
void set_date_value(double value) { m_date_value = value; }

View file

@ -180,10 +180,6 @@ void DateConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(7), Attribute::Configurable);
}
DateConstructor::~DateConstructor()
{
}
// 21.4.2.1 Date ( ...values ), https://tc39.es/ecma262/#sec-date
ThrowCompletionOr<Value> DateConstructor::call()
{

View file

@ -16,7 +16,7 @@ class DateConstructor final : public NativeFunction {
public:
explicit DateConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~DateConstructor() override;
virtual ~DateConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -104,10 +104,6 @@ void DatePrototype::initialize(GlobalObject& global_object)
define_direct_property(vm.names.toGMTString, get_without_side_effects(vm.names.toUTCString), attr);
}
DatePrototype::~DatePrototype()
{
}
// thisTimeValue ( value ), https://tc39.es/ecma262/#thistimevalue
ThrowCompletionOr<Value> this_time_value(GlobalObject& global_object, Value value)
{

View file

@ -17,7 +17,7 @@ class DatePrototype final : public PrototypeObject<DatePrototype, Date> {
public:
explicit DatePrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~DatePrototype() override;
virtual ~DatePrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(get_date);

View file

@ -37,10 +37,6 @@ DeclarativeEnvironment::DeclarativeEnvironment(Environment* parent_scope, Span<B
{
}
DeclarativeEnvironment::~DeclarativeEnvironment()
{
}
void DeclarativeEnvironment::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -32,7 +32,7 @@ public:
DeclarativeEnvironment();
explicit DeclarativeEnvironment(Environment* parent_scope);
explicit DeclarativeEnvironment(Environment* parent_scope, Span<Binding const> bindings);
virtual ~DeclarativeEnvironment() override;
virtual ~DeclarativeEnvironment() override = default;
virtual ThrowCompletionOr<bool> has_binding(FlyString const& name, Optional<size_t>* = nullptr) const override;
virtual ThrowCompletionOr<void> create_mutable_binding(GlobalObject&, FlyString const& name, bool can_be_deleted) override;

View file

@ -134,10 +134,6 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
}
}
ECMAScriptFunctionObject::~ECMAScriptFunctionObject()
{
}
// 10.2.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist
ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argument, MarkedVector<Value> arguments_list)
{

View file

@ -37,7 +37,7 @@ public:
ECMAScriptFunctionObject(FlyString name, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_scope, PrivateEnvironment* private_scope, Object& prototype, FunctionKind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function);
virtual void initialize(GlobalObject&) override;
virtual ~ECMAScriptFunctionObject();
virtual ~ECMAScriptFunctionObject() override = default;
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override;

View file

@ -17,10 +17,6 @@ FinalizationRegistry::FinalizationRegistry(Realm& realm, JS::JobCallback cleanup
{
}
FinalizationRegistry::~FinalizationRegistry()
{
}
void FinalizationRegistry::add_finalization_record(Cell& target, Value held_value, Object* unregister_token)
{
VERIFY(!held_value.is_empty());

View file

@ -23,7 +23,7 @@ class FinalizationRegistry final
public:
explicit FinalizationRegistry(Realm&, JS::JobCallback, Object& prototype);
virtual ~FinalizationRegistry() override;
virtual ~FinalizationRegistry() override = default;
void add_finalization_record(Cell& target, Value held_value, Object* unregister_token);
bool remove_by_token(Object& unregister_token);

View file

@ -29,10 +29,6 @@ void FinalizationRegistryConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
FinalizationRegistryConstructor::~FinalizationRegistryConstructor()
{
}
// 26.2.1.1 FinalizationRegistry ( cleanupCallback ), https://tc39.es/ecma262/#sec-finalization-registry-cleanup-callback
ThrowCompletionOr<Value> FinalizationRegistryConstructor::call()
{

View file

@ -16,7 +16,7 @@ class FinalizationRegistryConstructor final : public NativeFunction {
public:
explicit FinalizationRegistryConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~FinalizationRegistryConstructor() override;
virtual ~FinalizationRegistryConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject&) override;

View file

@ -28,10 +28,6 @@ void FinalizationRegistryPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.FinalizationRegistry.as_string()), Attribute::Configurable);
}
FinalizationRegistryPrototype::~FinalizationRegistryPrototype()
{
}
// @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
{

View file

@ -17,7 +17,7 @@ class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationR
public:
FinalizationRegistryPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~FinalizationRegistryPrototype() override;
virtual ~FinalizationRegistryPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(cleanup_some);

View file

@ -35,10 +35,6 @@ void FunctionConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
FunctionConstructor::~FunctionConstructor()
{
}
// 20.2.1.1.1 CreateDynamicFunction ( constructor, newTarget, kind, args ), https://tc39.es/ecma262/#sec-createdynamicfunction
ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args)
{

View file

@ -19,7 +19,7 @@ public:
explicit FunctionConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~FunctionConstructor() override;
virtual ~FunctionConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -16,10 +16,6 @@ FunctionEnvironment::FunctionEnvironment(Environment* parent_scope)
{
}
FunctionEnvironment::~FunctionEnvironment()
{
}
void FunctionEnvironment::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -23,7 +23,7 @@ public:
};
explicit FunctionEnvironment(Environment* parent_scope);
virtual ~FunctionEnvironment() override;
virtual ~FunctionEnvironment() override = default;
ThisBindingStatus this_binding_status() const { return m_this_binding_status; }
void set_this_binding_status(ThisBindingStatus status) { m_this_binding_status = status; }

View file

@ -21,10 +21,6 @@ FunctionObject::FunctionObject(Object& prototype)
{
}
FunctionObject::~FunctionObject()
{
}
// 10.2.9 SetFunctionName ( F, name [ , prefix ] ), https://tc39.es/ecma262/#sec-setfunctionname
void FunctionObject::set_function_name(Variant<PropertyKey, PrivateName> const& name_arg, Optional<StringView> const& prefix)
{

View file

@ -19,7 +19,7 @@ class FunctionObject : public Object {
JS_OBJECT(Function, Object);
public:
virtual ~FunctionObject();
virtual ~FunctionObject() = default;
virtual void initialize(GlobalObject&) override { }
// Table 7: Additional Essential Internal Methods of Function Objects, https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects

View file

@ -39,10 +39,6 @@ void FunctionPrototype::initialize(GlobalObject& global_object)
define_direct_property(vm.names.name, js_string(heap(), ""), Attribute::Configurable);
}
FunctionPrototype::~FunctionPrototype()
{
}
// 20.2.3.1 Function.prototype.apply ( thisArg, argArray ), https://tc39.es/ecma262/#sec-function.prototype.apply
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
{

View file

@ -16,7 +16,7 @@ class FunctionPrototype final : public Object {
public:
explicit FunctionPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~FunctionPrototype() override;
virtual ~FunctionPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(apply);

View file

@ -27,10 +27,6 @@ void GeneratorFunctionConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.prototype, global_object.generator_function_prototype(), 0);
}
GeneratorFunctionConstructor::~GeneratorFunctionConstructor()
{
}
// 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction
ThrowCompletionOr<Value> GeneratorFunctionConstructor::call()
{

View file

@ -17,7 +17,7 @@ class GeneratorFunctionConstructor final : public NativeFunction {
public:
explicit GeneratorFunctionConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorFunctionConstructor() override;
virtual ~GeneratorFunctionConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;

View file

@ -25,9 +25,4 @@ void GeneratorFunctionPrototype::initialize(GlobalObject& global_object)
// 27.3.3.3 GeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generatorfunction.prototype-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "GeneratorFunction"), Attribute::Configurable);
}
GeneratorFunctionPrototype::~GeneratorFunctionPrototype()
{
}
}

View file

@ -18,7 +18,7 @@ class GeneratorFunctionPrototype final : public Object {
public:
explicit GeneratorFunctionPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorFunctionPrototype() override;
virtual ~GeneratorFunctionPrototype() override = default;
};
}

View file

@ -43,10 +43,6 @@ void GeneratorObject::initialize(GlobalObject&)
{
}
GeneratorObject::~GeneratorObject()
{
}
void GeneratorObject::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -19,7 +19,7 @@ public:
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
GeneratorObject(GlobalObject&, Object& prototype, ExecutionContext);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorObject() override;
virtual ~GeneratorObject() override = default;
void visit_edges(Cell::Visitor&) override;
ThrowCompletionOr<Value> next_impl(VM&, GlobalObject&, Optional<Value> next_argument, Optional<Value> value_to_throw);

View file

@ -27,10 +27,6 @@ void GeneratorPrototype::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Generator"), Attribute::Configurable);
}
GeneratorPrototype::~GeneratorPrototype()
{
}
// 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next
JS_DEFINE_NATIVE_FUNCTION(GeneratorPrototype::next)
{

View file

@ -18,7 +18,7 @@ class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, Gene
public:
explicit GeneratorPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorPrototype() override;
virtual ~GeneratorPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(next);

View file

@ -304,9 +304,7 @@ void GlobalObject::initialize_global_object()
m_json_parse_function = &get_without_side_effects(vm.names.JSON).as_object().get_without_side_effects(vm.names.parse).as_function();
}
GlobalObject::~GlobalObject()
{
}
GlobalObject::~GlobalObject() = default;
void GlobalObject::visit_edges(Visitor& visitor)
{

View file

@ -82,10 +82,6 @@ bool SimpleIndexedPropertyStorage::set_array_like_size(size_t new_size)
return true;
}
GenericIndexedPropertyStorage::GenericIndexedPropertyStorage()
{
}
GenericIndexedPropertyStorage::GenericIndexedPropertyStorage(SimpleIndexedPropertyStorage&& storage)
{
m_array_size = storage.array_like_size();

View file

@ -23,7 +23,7 @@ class GenericIndexedPropertyStorage;
class IndexedPropertyStorage {
public:
virtual ~IndexedPropertyStorage() {};
virtual ~IndexedPropertyStorage() = default;
virtual bool has_index(u32 index) const = 0;
virtual Optional<ValueAndAttributes> get(u32 index) const = 0;
@ -72,7 +72,7 @@ private:
class GenericIndexedPropertyStorage final : public IndexedPropertyStorage {
public:
explicit GenericIndexedPropertyStorage(SimpleIndexedPropertyStorage&&);
explicit GenericIndexedPropertyStorage();
explicit GenericIndexedPropertyStorage() = default;
virtual bool has_index(u32 index) const override;
virtual Optional<ValueAndAttributes> get(u32 index) const override;

View file

@ -24,10 +24,6 @@ void IteratorPrototype::initialize(GlobalObject& global_object)
define_native_function(*vm.well_known_symbol_iterator(), symbol_iterator, 0, attr);
}
IteratorPrototype::~IteratorPrototype()
{
}
// 27.1.2.1 %IteratorPrototype% [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::symbol_iterator)
{

View file

@ -16,7 +16,7 @@ class IteratorPrototype : public Object {
public:
IteratorPrototype(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~IteratorPrototype() override;
virtual ~IteratorPrototype() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(symbol_iterator);

View file

@ -42,10 +42,6 @@ void JSONObject::initialize(GlobalObject& global_object)
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "JSON"), Attribute::Configurable);
}
JSONObject::~JSONObject()
{
}
// 25.5.2 JSON.stringify ( value [ , replacer [ , space ] ] ), https://tc39.es/ecma262/#sec-json.stringify
ThrowCompletionOr<String> JSONObject::stringify_impl(GlobalObject& global_object, Value value, Value replacer, Value space)
{

View file

@ -16,7 +16,7 @@ class JSONObject final : public Object {
public:
explicit JSONObject(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~JSONObject() override;
virtual ~JSONObject() override = default;
// The base implementation of stringify is exposed because it is used by
// test-js to communicate between the JS tests and the C++ test runner.

View file

@ -18,10 +18,6 @@ Map::Map(Object& prototype)
{
}
Map::~Map()
{
}
// 24.1.3.1 Map.prototype.clear ( ), https://tc39.es/ecma262/#sec-map.prototype.clear
void Map::map_clear()
{

View file

@ -23,7 +23,7 @@ public:
static Map* create(GlobalObject&);
explicit Map(Object& prototype);
virtual ~Map() override;
virtual ~Map() override = default;
void map_clear();
bool map_remove(Value const&);

View file

@ -31,10 +31,6 @@ void MapConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
}
MapConstructor::~MapConstructor()
{
}
// 24.1.1.1 Map ( [ iterable ] ), https://tc39.es/ecma262/#sec-map-iterable
ThrowCompletionOr<Value> MapConstructor::call()
{

View file

@ -16,7 +16,7 @@ class MapConstructor final : public NativeFunction {
public:
explicit MapConstructor(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~MapConstructor() override;
virtual ~MapConstructor() override = default;
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<Object*> construct(FunctionObject&) override;

View file

@ -22,10 +22,6 @@ MapIterator::MapIterator(Map& map, Object::PropertyKind iteration_kind, Object&
{
}
MapIterator::~MapIterator()
{
}
void MapIterator::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -19,7 +19,7 @@ public:
static MapIterator* create(GlobalObject&, Map& map, Object::PropertyKind iteration_kind);
explicit MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype);
virtual ~MapIterator() override;
virtual ~MapIterator() override = default;
Map& map() const { return m_map; }
bool done() const { return m_done; }

Some files were not shown because too many files have changed in this diff Show more