-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastunits.h
188 lines (145 loc) · 3.13 KB
/
astunits.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#pragma once
#include "aststatements.h"
///////////// units
class unit : public ast
{
public:
unit()
{ };
virtual string getName()
{ return ""; }
virtual void createTypes()
{ }
};
class subclassdefine : public unit
{
private:
aExpr* thisclass;
aExpr* superclass;
public:
subclassdefine(aExpr* _thisclass, aExpr* _superclass)
: thisclass(_thisclass)
, superclass(_superclass)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~subclassdefine();
};
class propertydefine : public unit
{
private:
aExpr* obj;
aExpr* proptype;
symbolid propid;
public:
propertydefine(aExpr* _obj, aExpr* _proptype, symbolid _propid)
: obj(_obj)
, proptype(_proptype)
, propid(_propid)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~propertydefine();
};
class proceduredeclare : public unit
{
private:
aExpr* thisclass;
symbolid procname;
preplist* params;
public:
proceduredeclare(aExpr* _thisclass, symbolid _procname, preplist* _params)
: thisclass(_thisclass)
, procname(_procname)
, params(_params)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~proceduredeclare();
};
class functiondeclare : public unit
{
private:
theExpr* funcname;
aExpr* classname;
preplist* params;
aExpr* returntype;
public:
functiondeclare(theExpr* _funcname, aExpr* _classname, preplist* _params, aExpr* _returntype)
: funcname(_funcname)
, classname(_classname)
, params(_params)
, returntype(_returntype)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~functiondeclare();
};
class functionunit : public unit
{
protected:
statementlist* statements;
preplist* preps;
method* mymethod;
functionunit(statementlist* slist, preplist* p)
: statements(slist)
, preps(p)
, mymethod(0)
{ }
virtual void createTypes()
{ }
registerid generateCode(operation* &p);
virtual ~functionunit();
};
class run : public functionunit
{
public:
run(statementlist* slist)
: functionunit(slist, 0)
{ }
virtual void debug(int ind);
virtual void createTypes();
};
class proceduredefine : public functionunit
{
private:
symbolid name;
aExpr* obj;
public:
proceduredefine(symbolid nm, aExpr* ob, preplist* parameters, statementlist* slist)
: functionunit(slist, parameters)
, name(nm)
, obj(ob)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~proceduredefine();
};
class methoddefineunit : public functionunit
{
private:
theExpr* name;
aExpr* obj;
public:
methoddefineunit(theExpr* nm, aExpr* ob, preplist* parameters, statementlist* slist)
: functionunit(slist, parameters)
, name(nm)
, obj(ob)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~methoddefineunit();
};
class constructordefine : public functionunit
{
private:
aExpr* obj;
public:
constructordefine(aExpr* ob, preplist* parameters, statementlist* slist)
: functionunit(slist, parameters)
, obj(ob)
{ }
virtual void debug(int ind);
virtual void createTypes();
virtual ~constructordefine();
};