@@ -50,7 +50,7 @@ void discoverLVAssignStmt(
50
50
// --------------------------------------------------------
51
51
//to add a row to the local variable symbol table
52
52
//the lvst works as a set regarding the 'name' of the local variable
53
- void lvst_add (struct LVST * lvst , struct LVSTLine * line );
53
+ void lvst_add (struct LVST * lvst , struct LVSTLine * line , bool debug );
54
54
// --------------------------------------------------------
55
55
56
56
struct LVST * makeLocalVarSymTable (bool debug ){
@@ -90,7 +90,7 @@ void fillLocalVarSymTable(
90
90
line -> isArg = true;
91
91
line -> firstOccur = NULL ;
92
92
93
- lvst_add (st -> lvst , line );
93
+ lvst_add (st -> lvst , line , debug );
94
94
}
95
95
96
96
if (debug ){
@@ -130,10 +130,14 @@ void freeLVSTLine(struct LVSTLine* l){
130
130
free (l );
131
131
}
132
132
133
- void lvst_add (struct LVST * lvst , struct LVSTLine * line ){
134
-
135
- //no debug param, so we print
136
- printf ("lvst_add(%p, %p)\n" , lvst , line );
133
+ void lvst_add (
134
+ struct LVST * lvst ,
135
+ struct LVSTLine * line ,
136
+ bool debug
137
+ ){
138
+ if (debug ){
139
+ printf ("lvst_add(%p, %p)\n" , lvst , line );
140
+ }
137
141
138
142
//the local var symbol table works as a set
139
143
//with 'name' as the key
@@ -168,10 +172,15 @@ void lvst_add(struct LVST* lvst, struct LVSTLine* line){
168
172
lvst -> count += 1 ;
169
173
}
170
174
171
- struct LVSTLine * lvst_get (struct LVST * lvst , char * name ){
175
+ struct LVSTLine * lvst_get (
176
+ struct LVST * lvst ,
177
+ char * name ,
178
+ bool debug
179
+ ){
172
180
173
- //no debug param, so we print
174
- printf ("lvst_get(%p, %s)\n" , lvst , name );
181
+ if (debug ){
182
+ printf ("lvst_get(%p, %s)\n" , lvst , name );
183
+ }
175
184
176
185
for (int i = 0 ; i < lvst -> count ; i ++ ){
177
186
@@ -273,7 +282,7 @@ void discoverLVAssignStmt(
273
282
line -> firstOccur = a ;
274
283
line -> isArg = false;;
275
284
276
- lvst_add (st -> lvst , line );
285
+ lvst_add (st -> lvst , line , debug );
277
286
}
278
287
279
288
void lvst_print (struct LVST * lvst ){
0 commit comments