mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
LibJS: Make it possible to visit the edges of an ExecutionContext
This commit is contained in:
parent
40cc38869e
commit
6431dd7904
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