#include #ifndef PORYGONLANG_BOUNDSTATEMENT_HPP #define PORYGONLANG_BOUNDSTATEMENT_HPP #include #include "../BoundExpressions/BoundExpression.hpp" using namespace std; enum class BoundStatementKind{ Script, Block, Expression, }; class BoundStatement{ public: virtual BoundStatementKind GetKind() = 0; virtual ~BoundStatement() = default; }; class BoundBlockStatement : public BoundStatement{ vector _statements; public: explicit BoundBlockStatement(vector statements){ _statements = std::move(statements); } ~BoundBlockStatement() override { for (auto s : _statements){ delete s; } _statements.clear(); } BoundStatementKind GetKind() override{ return BoundStatementKind ::Block; } }; class BoundScriptStatement : public BoundBlockStatement{ public: explicit BoundScriptStatement(vector statements) : BoundBlockStatement(std::move(statements)){ } BoundStatementKind GetKind() final{ return BoundStatementKind ::Script; } }; class BoundExpressionStatement : public BoundStatement{ BoundExpression* _expression; public: explicit BoundExpressionStatement(BoundExpression* expression){ _expression = expression; } ~BoundExpressionStatement() final{ delete _expression; } BoundStatementKind GetKind() final{ return BoundStatementKind ::Expression; } }; #endif //PORYGONLANG_BOUNDSTATEMENT_HPP