mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibJS: Parse object expressions
This commit is contained in:
parent
c64b5e73f5
commit
bc002f807a
7 changed files with 48 additions and 4 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
|
@ -572,13 +573,18 @@ private:
|
|||
|
||||
class ObjectExpression : public Expression {
|
||||
public:
|
||||
ObjectExpression() {}
|
||||
ObjectExpression(HashMap<String, NonnullRefPtr<Expression>> properties = {})
|
||||
: m_properties(properties)
|
||||
{
|
||||
}
|
||||
|
||||
virtual Value execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "ObjectExpression"; }
|
||||
|
||||
HashMap<String, NonnullRefPtr<Expression>> m_properties;
|
||||
};
|
||||
|
||||
class ArrayExpression : public Expression {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue