Initial layout for binder

This commit is contained in:
2019-05-21 18:09:08 +02:00
parent 2df4a71ed8
commit 1e5cd010a1
7 changed files with 89 additions and 9 deletions

View File

@@ -0,0 +1,49 @@
#include <utility>
#ifndef PORYGONLANG_BOUNDSTATEMENT_HPP
#define PORYGONLANG_BOUNDSTATEMENT_HPP
#include <vector>
using namespace std;
enum class BoundStatementKind{
Script,
Block,
};
class BoundStatement{
public:
virtual BoundStatementKind GetKind() = 0;
virtual ~BoundStatement() = default;
};
class BoundBlockStatement : public BoundStatement{
vector<BoundStatement*> _statements;
public:
explicit BoundBlockStatement(vector<BoundStatement*> 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<BoundStatement*> statements) : BoundBlockStatement(std::move(statements)){
}
BoundStatementKind GetKind() final{
return BoundStatementKind ::Script;
}
};
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP