-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcase.h
More file actions
29 lines (23 loc) · 724 Bytes
/
case.h
File metadata and controls
29 lines (23 loc) · 724 Bytes
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
#ifndef __CASE_H
#define __CASE_H
#include "ast.h"
class Stmt;
class Case : public ASTnode {
private:
int number;
Stmt* stmt;
bool hasBreak;
Case* next;
int label;
public:
// will be set when code is generated
Case(int number, Stmt* stmt, bool hasBreak) : number(number), stmt(stmt), hasBreak(hasBreak), next(nullptr), label(-1) {};
Stmt* getStmt() const { return stmt; };
Case* getNext() const { return next; };
int getNumber() const { return number; };
int getLabel() const { return label; };
//bool getHasBreak() const { return hasBreak; };
void setLabel(const int label) { this->label = label; };
void setNext(Case* next) { this->next = next; };
};
#endif