mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 08:27:35 +00:00
LibJS: Add support for do..while statements
This commit is contained in:
parent
da0715aba9
commit
f8393b80e3
5 changed files with 74 additions and 0 deletions
|
@ -257,6 +257,27 @@ private:
|
|||
NonnullRefPtr<ScopeNode> m_body;
|
||||
};
|
||||
|
||||
class DoWhileStatement : public Statement {
|
||||
public:
|
||||
DoWhileStatement(NonnullRefPtr<Expression> test, NonnullRefPtr<ScopeNode> body)
|
||||
: m_test(move(test))
|
||||
, m_body(move(body))
|
||||
{
|
||||
}
|
||||
|
||||
const Expression& test() const { return *m_test; }
|
||||
const ScopeNode& body() const { return *m_body; }
|
||||
|
||||
virtual Value execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "DoWhileStatement"; }
|
||||
|
||||
NonnullRefPtr<Expression> m_test;
|
||||
NonnullRefPtr<ScopeNode> m_body;
|
||||
};
|
||||
|
||||
class ForStatement : public Statement {
|
||||
public:
|
||||
ForStatement(RefPtr<ASTNode> init, RefPtr<Expression> test, RefPtr<Expression> update, NonnullRefPtr<ScopeNode> body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue