1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibJS: Support "hello friends".length

The above snippet is a MemberExpression that necessitates the implicit
construction of a StringObject wrapper around a PrimitiveString.

We then do a property lookup (a "get") on the StringObject, where we
find the "length" property. This is pretty neat! :^)
This commit is contained in:
Andreas Kling 2020-03-11 18:58:19 +01:00
parent 6ec6fa1a02
commit 542108421e
6 changed files with 100 additions and 11 deletions

View file

@ -27,14 +27,15 @@
#include <AK/LogStream.h>
#include <LibJS/Cell.h>
#include <LibJS/Object.h>
#include <LibJS/PrimitiveString.h>
#include <LibJS/Value.h>
namespace JS {
void Cell::Visitor::visit(Value value)
{
if (value.is_object())
visit(value.as_object());
if (value.is_cell())
visit(value.as_cell());
}
const LogStream& operator<<(const LogStream& stream, const Cell* cell)