mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS+LibWeb: Add missing GC marking visits
This adds visit_edges(Cell::Visitor&) methods to various helper structs that contain GC pointers, and makes sure they are called from owning GC-heap-allocated objects as needed. These were found by our Clang plugin after expanding its capabilities. The added rules will be enforced by CI going forward.
This commit is contained in:
committed by
Andreas Kling
parent
2677338f43
commit
a9cc425cde
Notes:
github-actions[bot]
2026-01-07 11:50:00 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/a9cc425cdee Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7351 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/trflynn89
23
Libraries/LibJS/Runtime/ClassFieldDefinition.cpp
Normal file
23
Libraries/LibJS/Runtime/ClassFieldDefinition.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/ClassFieldDefinition.h>
|
||||
#include <LibJS/Runtime/ECMAScriptFunctionObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
void ClassFieldDefinition::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
name.visit(
|
||||
[&](PropertyKey const& key) { key.visit_edges(visitor); },
|
||||
[&](PrivateName const&) {});
|
||||
initializer.visit(
|
||||
[&](GC::Ref<ECMAScriptFunctionObject>& function) { visitor.visit(function); },
|
||||
[&](Value& value) { visitor.visit(value); },
|
||||
[&](Empty) {});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user