mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 03:11:53 +00:00
LibJS: Parse "with" statements :^)
This commit is contained in:
parent
98f2da9834
commit
d617120499
Notes:
sideshowbarker
2024-07-19 01:13:07 +09:00
Author: https://github.com/awesomekling
Commit: d617120499
4 changed files with 55 additions and 0 deletions
|
@ -351,6 +351,27 @@ private:
|
|||
NonnullRefPtr<Statement> m_body;
|
||||
};
|
||||
|
||||
class WithStatement final : public Statement {
|
||||
public:
|
||||
WithStatement(NonnullRefPtr<Expression> object, NonnullRefPtr<Statement> body)
|
||||
: m_object(move(object))
|
||||
, m_body(move(body))
|
||||
{
|
||||
}
|
||||
|
||||
const Expression& object() const { return *m_object; }
|
||||
const Statement& body() const { return *m_body; }
|
||||
|
||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "WithStatement"; }
|
||||
|
||||
NonnullRefPtr<Expression> m_object;
|
||||
NonnullRefPtr<Statement> m_body;
|
||||
};
|
||||
|
||||
class ForStatement final : public Statement {
|
||||
public:
|
||||
ForStatement(RefPtr<ASTNode> init, RefPtr<Expression> test, RefPtr<Expression> update, NonnullRefPtr<Statement> body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue