mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 01:44:58 +00:00
LibJS: Add a convenience helper for visiting a JS::Value
We only really care to visit values if they refer to a Cell, but it's nice to be able to say visit(some_value).
This commit is contained in:
parent
05c80cac20
commit
386867da9f
3 changed files with 12 additions and 4 deletions
|
@ -26,9 +26,17 @@
|
|||
|
||||
#include <AK/LogStream.h>
|
||||
#include <LibJS/Cell.h>
|
||||
#include <LibJS/Object.h>
|
||||
#include <LibJS/Value.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
void Cell::Visitor::visit(Value value)
|
||||
{
|
||||
if (value.is_object())
|
||||
visit(value.as_object());
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const Cell* cell)
|
||||
{
|
||||
if (!cell)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue