mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
LibJS: Make it possible to visit the edges of an ExecutionContext
This commit is contained in:
parent
40cc38869e
commit
6431dd7904
Notes:
sideshowbarker
2024-07-17 07:08:37 +09:00
Author: https://github.com/Lubrsi
Commit: 6431dd7904
Pull-request: https://github.com/SerenityOS/serenity/pull/16428
Reviewed-by: https://github.com/linusg
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 19 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -38,4 +39,20 @@ ExecutionContext ExecutionContext::copy() const
|
|||
return copy;
|
||||
}
|
||||
|
||||
void ExecutionContext::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(function);
|
||||
visitor.visit(realm);
|
||||
visitor.visit(variable_environment);
|
||||
visitor.visit(lexical_environment);
|
||||
visitor.visit(private_environment);
|
||||
visitor.visit(context_owner);
|
||||
visitor.visit(this_value);
|
||||
script_or_module.visit(
|
||||
[](Empty) {},
|
||||
[&](auto& script_or_module) {
|
||||
visitor.visit(script_or_module);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ struct ExecutionContext {
|
|||
|
||||
[[nodiscard]] ExecutionContext copy() const;
|
||||
|
||||
void visit_edges(Cell::Visitor&);
|
||||
|
||||
private:
|
||||
explicit ExecutionContext(MarkedVector<Value> existing_arguments);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue