-
Notifications
You must be signed in to change notification settings - Fork 0
/
AssignExpr.h
60 lines (48 loc) · 1.17 KB
/
AssignExpr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef SS_ASSIGNEXPR_H
#define SS_ASSIGNEXPR_H
#include "Expr.h"
#include "BinaryExpr.h"
namespace SS {
class SS_EXPORT AssignExpr : public Expr
{
public:
SS_CLASS(AssignExpr, "AssignExpr", Expr);
AssignExpr(BinaryOp op, Expr* left, Expr* right) : m_op(op), m_left(left), m_right(right) {}
virtual ~AssignExpr()
{
delete m_left;
delete m_right;
}
SS_GETSET(BinaryOp, Op, m_op);
SS_GETSET(Expr*, Left, m_left);
SS_GETSET(Expr*, Right, m_right);
String GetOpName() const
{
switch(m_op)
{
case BINOP_ADD: return "+=";
case BINOP_SUB: return "-=";
case BINOP_MUL: return "*=";
case BINOP_DIV: return "/=";
case BINOP_MOD: return "%=";
case BINOP_POW: return "**=";
case BINOP_BIT_AND: return "&=";
case BINOP_BIT_OR: return "|=";
case BINOP_BIT_XOR: return "^=";
case BINOP_LOG_AND: return "&&=";
case BINOP_LOG_OR: return "||=";
case BINOP_SHL: return "<<=";
case BINOP_SHR: return ">>=";
case BINOP_NONE: return "=";
default:
return "<INVALID ASSIGN OP>";
}
}
// TODO: Other expr. stuff
private:
BinaryOp m_op;
Expr* m_left;
Expr* m_right;
};
}
#endif // SS_ASSIGNEXPR_H