mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
patterns: Added function while loops
This commit is contained in:
@@ -480,10 +480,14 @@ namespace hex::lang {
|
||||
|
||||
class ASTNodeWhileStatement : public ASTNode {
|
||||
public:
|
||||
explicit ASTNodeWhileStatement(ASTNode *condition) : ASTNode(), m_condition(condition) { }
|
||||
explicit ASTNodeWhileStatement(ASTNode *condition, std::vector<ASTNode*> body)
|
||||
: ASTNode(), m_condition(condition), m_body(std::move(body)) { }
|
||||
|
||||
~ASTNodeWhileStatement() override {
|
||||
delete this->m_condition;
|
||||
|
||||
for (auto &statement : this->m_body)
|
||||
delete statement;
|
||||
}
|
||||
|
||||
ASTNodeWhileStatement(const ASTNodeWhileStatement &other) : ASTNode(other) {
|
||||
@@ -498,8 +502,13 @@ namespace hex::lang {
|
||||
return this->m_condition;
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<ASTNode*>& getBody() {
|
||||
return this->m_body;
|
||||
}
|
||||
|
||||
private:
|
||||
ASTNode *m_condition;
|
||||
std::vector<ASTNode*> m_body;
|
||||
};
|
||||
|
||||
class ASTNodeFunctionCall : public ASTNode {
|
||||
|
||||
Reference in New Issue
Block a user