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
commit 542108421e
Notes: sideshowbarker 2024-07-19 08:46:33 +09:00
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)