ifExpr.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "core/ast/expr.hpp"
6
7namespace by {
8
13 class _nout ifExpr: public expr {
14 BY(CLASS(ifExpr, expr, expr::exprType), VISIT())
15 friend class verifier;
16
17 public:
18 ifExpr(const node& exp, const blockExpr& thenBlk);
19 ifExpr(const node& exp, const blockExpr& thenBlk, const blockExpr& elseBlk);
20
21 public:
22 blockExpr& getThen();
23 const blockExpr& getThen() const BY_CONST_FUNC(getThen())
24 void setThen(const blockExpr& newThen);
25 void setThen(const blockExpr* it) BY_SIDE_FUNC(setThen);
26
27 blockExpr* getElse();
28 const blockExpr* getElse() const BY_CONST_FUNC(getElse())
29 void setElse(const blockExpr& newElse);
30 void setElse(const blockExpr* it) BY_SIDE_FUNC(setElse);
31
32 node& getCondition();
33 const node& getCondition() const BY_CONST_FUNC(getCondition())
34 void setCondition(const node& newCondition);
35 void setCondition(const node* it) BY_SIDE_FUNC(setCondition);
36
37 using super::run;
38 str run(const args& a) override;
39
40 str getEval() const override;
41
42 private:
43 str _expr;
44 tstr<blockExpr> _then;
45 tstr<blockExpr> _else;
46 };
47} // namespace by
Function call arguments container.
Definition: args.hpp:13
Block expression containing multiple statements.
Definition: blockExpr.hpp:15
Type information for expression nodes
Definition: expr.hpp:22
Base class for all expressions.
Definition: expr.hpp:15
If conditional expression.
Definition: ifExpr.hpp:13
str getEval() const override
Base class for all AST nodes in byeol language.
Definition: node.hpp:30
AST verifier for semantic analysis.
Definition: verifier.hpp:20