Implements if, elseif and else statements
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -18,6 +18,7 @@ enum class BoundStatementKind{
|
||||
Assignment,
|
||||
FunctionDeclaration,
|
||||
Return,
|
||||
Conditional,
|
||||
};
|
||||
|
||||
class BoundStatement{
|
||||
@@ -135,6 +136,41 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class BoundConditionalStatement : public BoundStatement{
|
||||
BoundExpression* _condition;
|
||||
BoundStatement* _block;
|
||||
BoundStatement* _elseStatement;
|
||||
public:
|
||||
explicit BoundConditionalStatement(BoundExpression* condition, BoundStatement* block, BoundStatement* next){
|
||||
_condition = condition;
|
||||
_block = block;
|
||||
_elseStatement = next;
|
||||
}
|
||||
|
||||
~BoundConditionalStatement() final{
|
||||
delete _condition;
|
||||
delete _block;
|
||||
delete _elseStatement;
|
||||
}
|
||||
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Conditional;
|
||||
}
|
||||
|
||||
BoundExpression* GetCondition(){
|
||||
return _condition;
|
||||
}
|
||||
|
||||
BoundStatement* GetBlock(){
|
||||
return _block;
|
||||
}
|
||||
|
||||
BoundStatement* GetElseStatement(){
|
||||
return _elseStatement;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#include "BoundFunctionDeclarationStatement.hpp"
|
||||
|
||||
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user