Implements return statement
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-07 15:23:13 +02:00
parent f143e526ab
commit f4a3918947
12 changed files with 145 additions and 18 deletions

View File

@@ -1,9 +1,8 @@
#include <utility>
#ifndef PORYGONLANG_BOUNDSTATEMENT_HPP
#define PORYGONLANG_BOUNDSTATEMENT_HPP
#include <utility>
#include <vector>
#include "../BoundExpressions/BoundExpression.hpp"
#include "../BoundVariables/BoundVariableKey.hpp"
@@ -18,6 +17,7 @@ enum class BoundStatementKind{
Expression,
Assignment,
FunctionDeclaration,
Return,
};
class BoundStatement{
@@ -116,6 +116,25 @@ public:
}
};
class BoundReturnStatement : public BoundStatement{
BoundExpression* _expression;
public:
explicit BoundReturnStatement(BoundExpression* expression){
_expression = expression;
}
~BoundReturnStatement() final{
delete _expression;
}
BoundStatementKind GetKind() final{
return BoundStatementKind ::Return;
}
BoundExpression* GetExpression(){
return _expression;
}
};
#include "BoundFunctionDeclarationStatement.hpp"
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP