mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibJS: Parse object expressions
This commit is contained in:
parent
c64b5e73f5
commit
bc002f807a
Notes:
sideshowbarker
2024-07-19 08:12:30 +09:00
Author: https://github.com/0xtechnobabble
Commit: bc002f807a
Pull-request: https://github.com/SerenityOS/serenity/pull/1494
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